mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 13:33:50 +03:00
provide headers fixes for AppletTable in ExportDlg
This commit is contained in:
parent
a45b97a2b1
commit
f63622db0f
@ -39,6 +39,9 @@ ExportTemplateDialog::ExportTemplateDialog(SettingsDialog *parent, Controller::L
|
||||
m_ui->setupUi(this);
|
||||
//! we must create handlers after creating/adjusting the ui
|
||||
m_handler = new Handler::ExportTemplateHandler(this);
|
||||
|
||||
m_ui->appletsTable->horizontalHeader()->setStretchLastSection(true);
|
||||
m_ui->appletsTable->verticalHeader()->setVisible(false);
|
||||
}
|
||||
|
||||
ExportTemplateDialog::~ExportTemplateDialog()
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Personal Data</string>
|
||||
<string notr="true">Export Template</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include "../../data/appletdata.h"
|
||||
#include "../../layouts/storage.h"
|
||||
|
||||
//! KDE
|
||||
#include <KLocalizedString>
|
||||
|
||||
namespace Latte {
|
||||
namespace Settings {
|
||||
namespace Handler {
|
||||
@ -62,10 +65,13 @@ void ExportTemplateHandler::init()
|
||||
void ExportTemplateHandler::loadCurrentLayoutApplets()
|
||||
{
|
||||
Data::Layout o_layout = m_parentDialog->layoutsController()->selectedLayoutOriginalData();
|
||||
Data::Layout c_layout = m_parentDialog->layoutsController()->selectedLayoutCurrentData();
|
||||
|
||||
c_data = Latte::Layouts::Storage::self()->plugins(o_layout.id);
|
||||
o_data = c_data;
|
||||
|
||||
m_appletsModel->setData(c_data);
|
||||
m_parentDialog->setWindowTitle(i18n("Export Template from %0").arg(c_layout.name));
|
||||
}
|
||||
|
||||
bool ExportTemplateHandler::dataAreChanged() const
|
||||
|
@ -56,7 +56,7 @@ int Applets::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
|
||||
return DESCRIPTIONROLE+1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Applets::row(const QString &id)
|
||||
@ -90,6 +90,31 @@ void Applets::setData(const Latte::Data::AppletsTable &applets)
|
||||
}
|
||||
}
|
||||
|
||||
QVariant Applets::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation != Qt::Horizontal) {
|
||||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
if (role == Qt::FontRole) {
|
||||
QFont font = qvariant_cast<QFont>(QAbstractTableModel::headerData(section, orientation, role));
|
||||
font.setBold(true);
|
||||
return font;
|
||||
}
|
||||
|
||||
switch(section) {
|
||||
case NAMECOLUMN:
|
||||
if (role == Qt::DisplayRole) {
|
||||
return QString(i18nc("column for current applets", "Current Applets"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
QVariant Applets::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const int row = index.row();
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
int row(const QString &id);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
void setData(const Latte::Data::AppletsTable &applets);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user