February 24, 2012

ronM71 ronM71
Lab Rat
225 posts

setTextAlignment has no effect with QListWidget items

 

  1. MyItem = new QListWidgetItem(QIcon(), "Testing");
  2. MyItem->setTextAlignment(Qt::AlignHCenter);
  3. this->GetListWidget()->addItem(MyItem);

“Testing” will always appear aligned to the left. why?

1 reply

February 25, 2012

leon.anavi leon.anavi
Mad Scientist
1062 posts

Please try to example code posted at this FAQ: How can I align the text and icons in an itemview? [developer.qt.nokia.com]

 Signature 

http://anavi.org/

 
  ‹‹ Silly question - how to permahide snippets of code?      [Solved] Can’t compile project with makefile generated by qtmake ››

You must log in to post a reply. Not a member yet? Register here!