13 quitAction->setShortcut(
tr(
"Ctrl+Q"));
18 removeAction = itemsMenu->
addAction(
tr(
"&Remove Item"));
21 ascendingAction = itemsMenu->
addAction(
tr(
"Sort in &Ascending Order"));
22 descendingAction = itemsMenu->
addAction(
tr(
"Sort in &Descending Order"));
23 autoSortAction = itemsMenu->
addAction(
tr(
"&Automatically Sort Items"));
24 autoSortAction->setCheckable(
true);
27 findItemsAction->setShortcut(
tr(
"Ctrl+F"));
38 headers <<
tr(
"Subject") <<
tr(
"Default");
58void MainWindow::setupTreeItems()
77void MainWindow::findItems()
88 if ((*it)->text(0) == itemText)
89 (*it)->setSelected(
true);
95void MainWindow::insertItem()
103 tr(
"Input text for the new item:"));
118void MainWindow::removeItem()
137void MainWindow::sortAscending()
142void MainWindow::sortDescending()
153void MainWindow::updateSortItems()
155 ascendingAction->setEnabled(!autoSortAction->isChecked());
156 descendingAction->setEnabled(!autoSortAction->isChecked());
The QAction class provides an abstraction for user commands that can be added to different user inter...
void triggered(bool checked=false)
This signal is emitted when an action is activated by the user; for example, when the user clicks a m...
void setCentralWidget(QWidget *widget)
Sets the given widget to be the main window's central widget.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setSortingEnabled(bool enable)
QSet< QString >::iterator it
insertRed setText("insert red text")