mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Format code using clang-format
This commit is contained in:
@ -15,13 +15,13 @@
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
|
||||
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);
|
||||
QPushButton *resetButton = new QPushButton(tr("Restore defaults"), this);
|
||||
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);
|
||||
|
||||
actionsTableView = new QTableView(this);
|
||||
@ -29,12 +29,12 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
actionsTableView->horizontalHeader()->setHidden(true);
|
||||
splitter->addWidget(actionsGroupsListView);
|
||||
splitter->addWidget(actionsTableView);
|
||||
splitter->setStretchFactor(1,1);
|
||||
splitter->setStretchFactor(1, 1);
|
||||
splitter->setSizes(QList<int>() << 200 << 400);
|
||||
|
||||
layout->addWidget(infoLabel,0);
|
||||
layout->addWidget(splitter,1);
|
||||
layout->addWidget(resetButton,0,Qt::AlignRight);
|
||||
layout->addWidget(infoLabel, 0);
|
||||
layout->addWidget(splitter, 1);
|
||||
layout->addWidget(resetButton, 0, Qt::AlignRight);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
@ -43,13 +43,13 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
actionsGroupsListView->setModel(groupsModel);
|
||||
actionsGroupsListView->setFocus();
|
||||
actionsTableView->setModel(actionsModel);
|
||||
actionsTableView->setColumnWidth(0,30);
|
||||
actionsTableView->setColumnWidth(1,360);
|
||||
actionsTableView->setColumnWidth(0, 30);
|
||||
actionsTableView->setColumnWidth(1, 360);
|
||||
//actionsTableView->horizontalHeader()->sectionResizeMode(QHeaderView::Custom);
|
||||
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
||||
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
actionsTableView->setShowGrid(false);
|
||||
actionsTableView->setItemDelegateForColumn(ActionsShortcutsModel::KEYS,new EditShortcutItemDelegate(this));
|
||||
actionsTableView->setItemDelegateForColumn(ActionsShortcutsModel::KEYS, new EditShortcutItemDelegate(this));
|
||||
actionsTableView->installEventFilter(this);
|
||||
/*actionsTableView->setStyleSheet("QTableView {outline: 0px;}"
|
||||
"QTableView::item {outline: 0px;}");
|
||||
@ -57,15 +57,14 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
"QTableView::item:selected {outline: 0px; border: 0px;}"
|
||||
"");*/
|
||||
|
||||
|
||||
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(actionsModel,SIGNAL(conflict(QString)),this,SLOT(processConflict(QString)));
|
||||
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(actionsModel, SIGNAL(conflict(QString)), this, SLOT(processConflict(QString)));
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setFixedSize(760,500);
|
||||
setFixedSize(760, 500);
|
||||
#else
|
||||
setFixedSize(804,500); //extra width for modifiers
|
||||
setFixedSize(804, 500); //extra width for modifiers
|
||||
#endif
|
||||
setWindowTitle(tr("Shortcuts settings"));
|
||||
|
||||
@ -74,17 +73,16 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
|
||||
void EditShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group)
|
||||
{
|
||||
groupsModel->addActionsGroup(ActionsGroup(name,ico,group));
|
||||
if(actionsTableView->model()->rowCount()==0)//first group added
|
||||
actionsGroupsListView->selectionModel()->select(groupsModel->index(0,0),QItemSelectionModel::Select);
|
||||
groupsModel->addActionsGroup(ActionsGroup(name, ico, group));
|
||||
if (actionsTableView->model()->rowCount() == 0) //first group added
|
||||
actionsGroupsListView->selectionModel()->select(groupsModel->index(0, 0), QItemSelectionModel::Select);
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::resetToDefaults()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
|
||||
void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi, const QModelIndex &mi2)
|
||||
{
|
||||
Q_UNUSED(mi2);
|
||||
|
||||
@ -93,5 +91,5 @@ void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex
|
||||
|
||||
void EditShortcutsDialog::processConflict(const QString &shortcutInConflict)
|
||||
{
|
||||
QMessageBox::warning(this,tr("Shortcut in use"), QString(tr("The shortcut \"%1\" is already assigned to other function")).arg(shortcutInConflict));
|
||||
QMessageBox::warning(this, tr("Shortcut in use"), QString(tr("The shortcut \"%1\" is already assigned to other function")).arg(shortcutInConflict));
|
||||
}
|
||||
|
Reference in New Issue
Block a user