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. Several questions about Qt GUI and Qt Test

Several questions about Qt GUI and Qt Test

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k 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.
  • R Offline
    R Offline
    Rexona for men
    wrote on last edited by
    #1
    1. Can I grey out items in a QComboBox so that they are not catching any input like disabled buttons? The items should still be visible in the combobox.

    2. I created a little newdialog for my application so the user can choose what he wants to create. I used the dialogs result variable to store a code and depending on that code I would proceed with the chosen action. In the documentation however it says, that it's recommend to return a DialogCode, which is either Accepted or Reject. Is my way still perfectly ok or are there better alternatives to return information from a dialog.

    3. Well, how do I use Qt Test effectively? I played a bit around with it in Qt Creator and it's surely nice, but since I need to create a new project and include and link the code that shall be tested, it doesn't look really useful to me. I would like to use it in the way I can use JUnit for Java in eclipse, esspecially with maven, so that I can run all tests with one click.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rexona for men
      wrote on last edited by
      #2

      Since this thread is already on page three, I will give it a little push. If more information needed, please feel free to ask, I just tried to keep my questions short and focused

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        Just remove the Qt::ItemIsEnabled flag from the item you want to be disabled.
        @
        QStandardItemModel model = static_cast<QStandardItemModel>(comboBox.model());
        QStandardItem *item = model->item(indexOfItemToBeDisabled);
        item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
        @
        I would prefer to not 'abuse' the return value; use a getter instead.
        @
        public NewDialog : public QDialog
        {
        enum Action
        {
        Action1,
        Action2,
        ...
        };

        public:
        Action action() { return ... }
        }

        NewDialog dialog;
        if (dialog.exec() == QDialog::Accepted)
        {
        switch(dialog.action())
        {
        case Action1: ...
        }
        }
        @
        As to QTest I would recommend to take a look at unit tests of Qt itself.

        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