mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 07:24:58 -04:00
shortcuts are now shown with their native representation, fixed edit shortcuts dialog layout
This commit is contained in:
@ -63,7 +63,7 @@ QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
||||
if (index.column() == NAME)
|
||||
return QVariant(actions[index.row()]->toolTip());
|
||||
if (index.column() == KEYS)
|
||||
return QVariant(actions[index.row()]->shortcut().toString());
|
||||
return QVariant(actions[index.row()]->shortcut().toString(QKeySequence::NativeText));
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -75,15 +75,15 @@ KeySequenceLineEdit::KeySequenceLineEdit(QWidget *parent)
|
||||
connect(acceptButton, SIGNAL(clicked()), this, SIGNAL(editingFinished()));
|
||||
}
|
||||
|
||||
void KeySequenceLineEdit::resizeEvent(QResizeEvent *)
|
||||
void KeySequenceLineEdit::resizeEvent(QResizeEvent * e)
|
||||
{
|
||||
QSize szClear = clearButton->sizeHint();
|
||||
//int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
int leftMargin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
|
||||
clearButton->move(0 + leftMargin,topMargin-4);
|
||||
clearButton->move(0 + leftMargin,(e->size().height()-19)/2); //16 is the icon height+1blank pixel
|
||||
|
||||
acceptButton->move( leftMargin + szClear.width(),topMargin-4);
|
||||
acceptButton->move( leftMargin + szClear.width(),(e->size().height()-19)/2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
|
||||
QLabel * infoLabel = new QLabel(tr("To change a shortcut, select it, click in the key combination and type the new keys."));
|
||||
QLabel * infoLabel = new QLabel(tr("To change a shortcut, double click in the key combination and type the new keys."));
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
QSplitter * splitter = new QSplitter(this);
|
||||
actionsGroupsListView = new QListView(this);
|
||||
@ -42,7 +42,8 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
actionsGroupsListView->setModel(groupsModel);
|
||||
actionsTableView->setModel(actionsModel);
|
||||
actionsTableView->setColumnWidth(0,30);
|
||||
actionsTableView->setColumnWidth(1,270);
|
||||
actionsTableView->setColumnWidth(1,360);
|
||||
//actionsTableView->horizontalHeader()->sectionResizeMode(QHeaderView::Custom);
|
||||
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
||||
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
actionsTableView->setShowGrid(false);
|
||||
@ -58,7 +59,11 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
connect(resetButton,SIGNAL(clicked()),this,SLOT(resetToDefaults()));
|
||||
connect(actionsGroupsListView->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(loadShortcuts(QModelIndex,QModelIndex))); //clicked(QModelIndex) doesn't work :S
|
||||
|
||||
setFixedSize(640,480);
|
||||
#ifdef Q_OS_MAC
|
||||
setFixedSize(760,500);
|
||||
#else
|
||||
setFixedSize(804,500); //extra width for modifiers
|
||||
#endif
|
||||
setWindowTitle(tr("Shortcuts settings"));
|
||||
|
||||
setModal(true);
|
||||
@ -79,4 +84,5 @@ void EditShortcutsDialog::resetToDefaults()
|
||||
void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
|
||||
{
|
||||
actionsModel->addActions(groupsModel->getActions(mi));
|
||||
//actionsTableView->resizeColumnsToContents();
|
||||
}
|
||||
|
Reference in New Issue
Block a user