Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Combobox with checkboxes problem with Qt4 and Qt5 difference.
Forum Updated to NodeBB v4.3 + New Features

Combobox with checkboxes problem with Qt4 and Qt5 difference.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kolegs
    wrote on last edited by
    #1

    Hi,

    I am tried to create combobox with checkboxes but I got a problem and dont know how to solve it.
    I have a code which create combobox with checkboxes but it only works on Qt4 and only when i run a program on root. But now I need to use the same code in Qt5 and I cant see any checkboxes, dont know why. I think the problem is connected to OS I use but not sure. I am using Ubuntu 12.04 with unity.

    Code and screens below:
    @ QStandardItemModel model = new QStandardItemModel(3, 1); // 3 rows, 1 col
    for(int i=0;i<3;i++)
    {
    QStandardItem
    item = new QStandardItem(QString::number(i));

        item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
        item->setData(Qt::Unchecked, Qt::CheckStateRole);
        model->setItem(i, 0, item);
    }
    ui->comboBox->setModel(model);@
    

    Screens:

    Qt4 root:
    !http://s4.postimg.org/css9cp2e5/Qt4_root.png(Qt4 ROOT)!
    Qt4:
    !http://s7.postimg.org/7972kpahn/Qt4.png(Qt4)!
    Qt5 root:
    !http://s28.postimg.org/w3ibvqe3h/Qt5_root.png(Qt5 ROOT)!
    Qt5:
    !http://s29.postimg.org/ilwkamu93/Qt5.png(Qt5)!

    1 Reply Last reply
    0
    • mranger90M Offline
      mranger90M Offline
      mranger90
      wrote on last edited by
      #2

      I've found that this works as expected with plastique and motif and cleanlooks styles, but not gtk. Using Ubuntu 13.10.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kolegs
        wrote on last edited by
        #3

        Ok, thanks I will check it tomorrow.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kolegs
          wrote on last edited by
          #4

          I can see it works when I run my applicatino from command line:
          @./app -style plastique@
          but the problem is in Qt5 motif, cleanooks and plastique styles are removed and you cant use it from the code. There is fusion style instead but this style also doesnt show checkboxes in combobox.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved