mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
enable Switch button in the layouts window
This commit is contained in:
parent
38e5fca05f
commit
f7558bb686
@ -55,6 +55,8 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
|
||||
|
||||
ui->layoutsView->setModel(m_model);
|
||||
|
||||
connect(m_manager, &LayoutManager::currentLayoutNameChanged, this, &LayoutConfigDialog::currentLayoutNameChanged);
|
||||
|
||||
loadLayouts();
|
||||
}
|
||||
|
||||
@ -159,5 +161,35 @@ void LayoutConfigDialog::loadLayouts()
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutConfigDialog::on_switchButton_clicked()
|
||||
{
|
||||
QString sRec = "not valid column";
|
||||
QVariant value = m_model->data(ui->layoutsView->currentIndex(), 2);
|
||||
|
||||
if (value.isValid()) {
|
||||
m_manager->switchToLayout(value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutConfigDialog::currentLayoutNameChanged()
|
||||
{
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
QModelIndex nameIndex = m_model->index(i, 2);
|
||||
QVariant value = m_model->data(nameIndex);
|
||||
|
||||
if (value.isValid()) {
|
||||
QFont font;
|
||||
|
||||
if (m_manager->currentLayoutName() == value.toString()) {
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
}
|
||||
|
||||
m_model->setData(nameIndex, font, Qt::FontRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}//end of namespace
|
||||
|
||||
|
@ -49,6 +49,7 @@ private slots:
|
||||
// auto connections
|
||||
void on_copyButton_clicked();
|
||||
void on_removeButton_clicked();
|
||||
void on_switchButton_clicked();
|
||||
void on_importButton_clicked();
|
||||
void on_exportButton_clicked();
|
||||
|
||||
@ -57,6 +58,8 @@ private slots:
|
||||
void apply();
|
||||
void restoreDefaults();
|
||||
|
||||
void currentLayoutNameChanged();
|
||||
|
||||
private:
|
||||
void loadLayouts();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user