Hello!
I have a question.
I'm writing small application now and when I was creating "Edit Shortcuts" dialog I've noticed that something was changed in QT.
In qt3 items of menus were not of type QAction, but in qt4 they are. Why?
Here is the code:
void MainWindow::loadActions()
{
settings.beginGroup("/Action");
QList<QAction *> actions = qFindChildren<QAction *>(this);
for (int i = 0; i < actions.size(); ++i)
{
QAction *action
= static_cast<QAction
*>
(actions.
at( i
));
QString accelText
= settings.
value(action
->text
()).
toString();
if (!accelText.isNull())
}
settings.endGroup();
}
void MainWindow::saveActions()
{
settings.beginGroup("/Action");
QList<QAction *> actions = qFindChildren<QAction *>(this);
for (int i = 0; i < actions.size(); ++i)
{
QAction *action
= static_cast<QAction
*>
(actions.
at( i
));
settings.setValue(action->text(), accelText);
}
settings.endGroup();
}
void MainWindow::loadActions()
{
QSettings settings;
settings.beginGroup("/Action");
QList<QAction *> actions = qFindChildren<QAction *>(this);
for (int i = 0; i < actions.size(); ++i)
{
QAction *action = static_cast<QAction*>(actions.at( i ));
QString accelText = settings.value(action->text()).toString();
if (!accelText.isNull())
action->setShortcut(QKeySequence(accelText));
}
settings.endGroup();
}
void MainWindow::saveActions()
{
QSettings settings;
settings.beginGroup("/Action");
QList<QAction *> actions = qFindChildren<QAction *>(this);
for (int i = 0; i < actions.size(); ++i)
{
QAction *action = static_cast<QAction*>(actions.at( i ));
QString accelText = QString(action->shortcut());
settings.setValue(action->text(), accelText);
}
settings.endGroup();
}
To copy to clipboard, switch view to plain text mode
It works good but in the "Edit Shortcuts" dialog in the table there are also items like these:
- File Actions
- &File
- & Help
This is the title of the menus...
How to disable them?
Thanks!
Bookmarks