Results 1 to 6 of 6

Thread: QComboBox Custom Widget has missing designer properties

  1. #1
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QComboBox Custom Widget has missing designer properties

    I can't understand why my custom widget is missing some designer functions, like in designer,
    the custom widget doesn't have any tab order and it doesn't appear in the tab order list.

    I'm thinking it's because I've placed it in a layout which doesn't have a tab order ?
    I had to do this because without it, my widget didn't show up when placing it on a form.

    Qt Code:
    1. DbComboBox::DbComboBox(QWidget *parent)
    2. : QWidget(parent)
    3. {
    4. cb = new QComboBox(this);
    5. cb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    6. cb->setEditable(true);
    7. cb->installEventFilter(this);
    8. connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int)));
    9. QHBoxLayout *layout = new QHBoxLayout;
    10. layout->addWidget(cb);
    11. layout->setContentsMargins(0,0,0,0);
    12. this->setLayout(layout);
    13. }
    To copy to clipboard, switch view to plain text mode 

    Also QComboBox public methods aren't available, when I compile my project with an instance of this part and access a method:
    Qt Code:
    1. m_ui->myComboBox->currentText
    To copy to clipboard, switch view to plain text mode 
    compiler says
    /home/vince/projects/Qt/myProject/plugins/DbComboBoxExtension/dbcombobox.h:56: error: ‘QString DbComboBox::currentText’ is private
    Can someone please point out why it isn't behaving ?
    Last edited by vieraci; 6th December 2009 at 11:20.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox Custom Widget has missing designer properties

    Search for currentText in your class declaration.
    May be you hav declared it private, or there some member variable by that name

  3. #3
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox Custom Widget has missing designer properties

    Quote Originally Posted by aamer4yu View Post
    Search for currentText in your class declaration.
    May be you hav declared it private, or there some member variable by that name
    currentText is a public method of QComboBox, but it's now private.
    Why ? I don't think I should have to expose every method ?

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox Custom Widget has missing designer properties

    I dont mean u will have to expose methods...what I mean is check if by mistake you have declared it as private...

  5. The following user says thank you to aamer4yu for this useful post:

    vieraci (7th December 2009)

  6. #5
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox Custom Widget has missing designer properties

    Quote Originally Posted by aamer4yu View Post
    I dont mean u will have to expose methods...what I mean is check if by mistake you have declared it as private...
    WOW! I Can't believe I DID declare a private variable by that name
    Now I remember why I did that too. Thanks for pointing it out.
    Now I'm left with my original problem...custom widget's tab order feature isn't there in designer.
    I'm positive it's something to do with it being a child of the layout. So how do I get rid of the layout ? have to re-implement paint event maybe ? how ?
    Last edited by vieraci; 7th December 2009 at 11:54. Reason: updated contents

  7. #6
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox Custom Widget has missing designer properties

    I still haven't worked it out, if this is a sticky one at least if I can get a reply stating "don't know" I'd feel better.

Similar Threads

  1. Replies: 3
    Last Post: 17th November 2009, 14:43
  2. Custom widget - Only works in Designer
    By Darhuuk in forum Qt Tools
    Replies: 6
    Last Post: 8th January 2008, 00:46
  3. Replies: 15
    Last Post: 25th March 2007, 03:40
  4. Replies: 5
    Last Post: 16th May 2006, 20:38
  5. Replies: 4
    Last Post: 1st March 2006, 23:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.