Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor RajeevSahu's Avatar
    Join Date
    Aug 2009
    Posts
    331
    Hi...

    I want to use a QComboBox in Symbian Phone. I implemented this for Windows and the drop down comes just below the QComboBox. How ever when the same is implemented and run on Symbian device the drop down comes below 40-50 pixels size.

    Also the native look and feel is not that good. I have used the following style sheet syntax:

    "QComboBox { background-image: url(:/imagesSymbian/combo.png); color: black; border: 1px solid grey;border-style: solid; border-width: 2px; border-radius: 5px; border-color: grey;} QComboBox::drop-down { subcontrol-origin: padding; color: black; background-image: none;}";
    Any ideas on this?

    Thanks...

  2. #2
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Make the best you can of a poor situation.

  3. #3
    Regular Contributor RajeevSahu's Avatar
    Join Date
    Aug 2009
    Posts
    331
    Is it possible to customize the QComboBox? Any suggestions, please...

    Thanks...

  4. #4
    Regular Contributor AlterX's Avatar
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153
    Quote Originally Posted by RajeevSahu View Post
    Is it possible to customize the QComboBox? Any suggestions, please...

    Thanks...
    I think you must use
    .QComboBox {
    ...
    }
    or QComboBox#comboName {
    ...
    }

    I think only QComboBox {} does nothing!
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  5. #5
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Yeah, I may have misinterpreted your post. Style Sheets do work for QComboBox, if coded correctly. The syntax is very fussy, and likely not all features can be adjusted, but it is possible to change the default look/feel.

    Unfortunately, even at its best, QComboBox is not very good.

    (Note that for coding Style Sheets you should study VERY CAREFULLY the online Qt documentation on that topic. Lots of good information there, but you have to dig a little.)

  6. #6
    Regular Contributor dahiya.vinod's Avatar
    Join Date
    Dec 2010
    Posts
    142
    Quote Originally Posted by RajeevSahu View Post
    Also the native look and feel is not that good.
    Yes, QComboBox looks bad on symbian and its choicelist popup even worse. I have to do some custom stuff (including button and dialogs) to make my application look and feel better.

  7. #7
    Regular Contributor RajeevSahu's Avatar
    Join Date
    Aug 2009
    Posts
    331
    Quote Originally Posted by dahiya.vinod View Post
    Yes, QComboBox looks bad on symbian and its choicelist popup even worse. I have to do some custom stuff (including button and dialogs) to make my application look and feel better.
    Yes, I tried my best to change the default look and feel, but didn't succeed. Please update this thread if you are able to make any changes to the default QComboBox. I'll also dig more on the StyleSheet part and will update the thread.

  8. #8
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Are you able to get style sheets to work for ANY sort of widget?

  9. #9
    Regular Contributor RajeevSahu's Avatar
    Join Date
    Aug 2009
    Posts
    331
    Quote Originally Posted by danhicksbyron View Post
    Are you able to get style sheets to work for ANY sort of widget?
    Yes, style sheets applied to this and other widgets are working fine. In this case only the Drop down comes in a different place. This might be a Qt Bug...

    Check this link:http://bugreports.qt.nokia.com/browse/QTBUG-12052

    I tried to implement as per the suggestions provided in this link. But still not able to display the Drop down just below the combobox... Any other suggestions?

    Thanks...

  10. #10
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    About all I can suggest is that you look at the documentation again -- make sure you have the "::drop-down" qualifier properly placed, and all of the keywords correct. But yes there were changes to the QComboBox in 4.7.3 (didn't make it much better but didn't make it any worse, IMO -- the concept is just wrong for a phone).

    If all else fails try your own style as suggested by the bug report.

  11. #11
    Registered User deepweb's Avatar
    Join Date
    Sep 2010
    Posts
    30
    Quote Originally Posted by dahiya.vinod View Post
    Yes, QComboBox looks bad on symbian and its choicelist popup even worse. I have to do some custom stuff (including button and dialogs) to make my application look and feel better.
    Do you like to share your code with us, because I (and many others) having the same problem that some parts of Qt UI are not suitable for mobile devices (yet?)

  12. #12
    Regular Contributor RajeevSahu's Avatar
    Join Date
    Aug 2009
    Posts
    331
    Hey,

    I have used the followings for QComboBox:

    QString combostyleSheet =
    "QComboBox { background-image: url(:/images/dropdown.png); color: black; border: 1px solid grey;border-style: solid; border-width: 1px; border-radius: 5px; border-color: grey;font-family: Arial, Helvetica, sans-serif; color:#000000; font-size:18px;}"
    "QComboBox::down-arrow {image: url(noimage); border-width: 0px;}"
    "QComboBox::drop-down { background-color: none; background-image: none; border: none; background: transparent;}"
    "QComboBox QAbstractItemView {background-image: url(:/images/backgroundimg.jpg); border: 0px solid darkgray;color: white;background-color: black; selection-background-color: lightgray;}";
    ui->comboBoxEventType->setStyle(new QWindowsStyle);//if use default "QS60Style" the List will come from bottom i.e. above "Options" key area.
    //int count = ui->comboBoxEventType->count();
    //for(int i=0; i<count;i++)
    //ui->comboBoxEventType->model()->setData(ui->comboBoxEventType->model()->index(0, i), QSize(70, 50), Qt::SizeHintRole);
    ui->comboBoxEventType->setStyleSheet(combostyleSheet);
    QScrollBar *scrollbarComboBox = ui->comboBoxEventType->view()->verticalScrollBar();
    scrollbarComboBox->setStyleSheet(
    "QScrollBar { background-image: none; border: 0px solid grey; border-width: 0px; border-radius: 5px; width: 15px; border-color: grey; background: transparent;}"
    "QScrollBar::handle {background-image: none; border: 1px solid grey;border-style: solid; border-width: 1px; border-radius: 5px; width: 15px; border-color: grey; background: lightgray; selection-background-color: lightgray; selection-color: yellow;selection-background-color: blue;}"
    );
    I hope this will help others too.

    Thanks...

Similar Threads

  1. QComboBox Allignment
    By maruthisri in forum Qt
    Replies: 1
    Last Post: 2010-06-08, 14:11
  2. problem in the Qt QComboBox!
    By mismael in forum Nokia N9
    Replies: 2
    Last Post: 2010-03-22, 09:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved