×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    QWidget in QListWidgetItem off-center

    When I add a QWidget to a QListWidgetItem (via QListWidget setItemWidget) the QWidget is displayed high in the QListWidgetItem for some reason, with blank space below it. (See attached screen shot.)

    This happens on both native Windows under Creator and on the Epoc emulator under Carbide.

    Here is the style sheet for the QListWidget:
    Code:
    #mScrollWindow {
    	border-width: 8;
    	border-image: url(:/images/FullLightBackground.png);
    }
    #mScrollWindow::item {
    	border-bottom:1px solid rgb(205, 205, 205);
    	padding: 0;
    }
    #mScrollWindow::item:selected { 
    	background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
            stop:0 #D0D0D0, stop: 0.4 #A8A8A8, stop:1 #909090);
        	color: white;
    }
    Also, the widget consists of three labels, the "Edit" is an image in one and the other two lines in two other labels. The two lines are in a QVBoxLayout and the image and QVBoxLayout are in a QHBoxLayout. Even though the top line has stretch=4 and the bottom line has stretch=2, the layout manager is sizing them the same, when I'd really like the top line to get more height.

    Any ideas?
    Attached Images Attached Images

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QWidget in QListWidgetItem off-center

    On rerunning this on Windows, I don't seem to have the problem anymore, but I still have it on Epoc (and, yes, I did rebuild everything from the same source).

    (It may be that the last change I made to add the "padding:0" to the style sheet fixed Windows.)

    Any ideas?

  3. #3
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QWidget in QListWidgetItem off-center

    Yeah, by changing the widget backgrounds from transparent to contrasting colors, I can see that Windows is properly sizing the two labels based on their "stretch" values, but Epoc isn't. And Windows is also centering the stuff vertically.

    So I guess this is a Qt/Symbian problem, not a generic Qt problem.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QWidget in QListWidgetItem off-center

    Could you please provide small test app containing only QListWidget?

  5. #5
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QWidget in QListWidgetItem off-center

    Quote Originally Posted by divanov View Post
    Could you please provide small test app containing only QListWidget?
    Maybe when I get a breather. Battling a deadline right now.

Similar Threads

  1. Wrong sms service center is used when changing sim card to send sms
    By lss0986 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-07-22, 08:58
  2. How to Connect to Nokia MMS Center if i am in Singapore?
    By sarahang in forum General Messaging
    Replies: 1
    Last Post: 2003-02-27, 23:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×