mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 15:35:03 -04:00
shortcuts are now shown with their native representation, fixed edit shortcuts dialog layout
This commit is contained in:
@ -51,7 +51,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget * parent)
|
|||||||
|
|
||||||
setLayout(imgMainLayout);
|
setLayout(imgMainLayout);
|
||||||
|
|
||||||
setFixedSize(QSize(700,500));
|
setFixedSize(QSize(700,500));
|
||||||
|
|
||||||
QFile f(":/files/shortcuts.html");
|
QFile f(":/files/shortcuts.html");
|
||||||
f.open(QIODevice::ReadOnly);
|
f.open(QIODevice::ReadOnly);
|
||||||
|
@ -63,7 +63,7 @@ QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
|||||||
if (index.column() == NAME)
|
if (index.column() == NAME)
|
||||||
return QVariant(actions[index.row()]->toolTip());
|
return QVariant(actions[index.row()]->toolTip());
|
||||||
if (index.column() == KEYS)
|
if (index.column() == KEYS)
|
||||||
return QVariant(actions[index.row()]->shortcut().toString());
|
return QVariant(actions[index.row()]->shortcut().toString(QKeySequence::NativeText));
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -75,15 +75,15 @@ KeySequenceLineEdit::KeySequenceLineEdit(QWidget *parent)
|
|||||||
connect(acceptButton, SIGNAL(clicked()), this, SIGNAL(editingFinished()));
|
connect(acceptButton, SIGNAL(clicked()), this, SIGNAL(editingFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeySequenceLineEdit::resizeEvent(QResizeEvent *)
|
void KeySequenceLineEdit::resizeEvent(QResizeEvent * e)
|
||||||
{
|
{
|
||||||
QSize szClear = clearButton->sizeHint();
|
QSize szClear = clearButton->sizeHint();
|
||||||
//int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
//int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
int leftMargin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
int leftMargin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||||
int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
|
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)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
|
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);
|
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||||
QSplitter * splitter = new QSplitter(this);
|
QSplitter * splitter = new QSplitter(this);
|
||||||
actionsGroupsListView = new QListView(this);
|
actionsGroupsListView = new QListView(this);
|
||||||
@ -42,7 +42,8 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
|||||||
actionsGroupsListView->setModel(groupsModel);
|
actionsGroupsListView->setModel(groupsModel);
|
||||||
actionsTableView->setModel(actionsModel);
|
actionsTableView->setModel(actionsModel);
|
||||||
actionsTableView->setColumnWidth(0,30);
|
actionsTableView->setColumnWidth(0,30);
|
||||||
actionsTableView->setColumnWidth(1,270);
|
actionsTableView->setColumnWidth(1,360);
|
||||||
|
//actionsTableView->horizontalHeader()->sectionResizeMode(QHeaderView::Custom);
|
||||||
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
||||||
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
actionsTableView->setShowGrid(false);
|
actionsTableView->setShowGrid(false);
|
||||||
@ -58,7 +59,11 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
|||||||
connect(resetButton,SIGNAL(clicked()),this,SLOT(resetToDefaults()));
|
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
|
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"));
|
setWindowTitle(tr("Shortcuts settings"));
|
||||||
|
|
||||||
setModal(true);
|
setModal(true);
|
||||||
@ -79,4 +84,5 @@ void EditShortcutsDialog::resetToDefaults()
|
|||||||
void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
|
void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
|
||||||
{
|
{
|
||||||
actionsModel->addActions(groupsModel->getActions(mi));
|
actionsModel->addActions(groupsModel->getActions(mi));
|
||||||
|
//actionsTableView->resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user