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