8#include "tableformatdialog.h"
9#include "inserttablewidget.h"
11#include <KColorButton>
12#include <KLocalizedString>
17#include <QDialogButtonBox>
23using namespace KPIMTextEdit;
25class TableFormatDialog::TableFormatDialogPrivate
28 explicit TableFormatDialogPrivate(TableFormatDialog *qq)
36 lay->setContentsMargins({});
37 tableWidget =
new InsertTableWidget;
38 lay->addWidget(tableWidget);
44 auto lab =
new QLabel(
i18nc(
"@label:textbox",
"Spacing:"));
48 hbox->addWidget(spacing);
49 lab =
new QLabel(
i18nc(
"@label:textbox",
"pixels between cells"));
54 lab =
new QLabel(
i18nc(
"@label:textbox",
"Padding:"));
58 hbox->addWidget(padding);
59 lab =
new QLabel(
i18nc(
"@label:textbox",
"pixels between cell border and content"));
73 lab =
new QLabel(
i18nc(
"@label:textbox",
"Table Alignment:"));
75 hbox->addWidget(alignment);
83 useBackgroundColor =
new QCheckBox(
i18nc(
"@option:check",
"Background Color:"));
85 hbox->addWidget(useBackgroundColor);
88 hbox->addWidget(backgroundColor);
99 mainLayout->addWidget(page);
100 mainLayout->addWidget(buttonBox);
108 KPIMTextEdit::InsertTableWidget *tableWidget =
nullptr;
109 TableFormatDialog *
const q;
112TableFormatDialog::TableFormatDialog(
QWidget *parent)
114 , d(new TableFormatDialogPrivate(this))
118TableFormatDialog::~TableFormatDialog() =
default;
120int TableFormatDialog::columns()
const
122 return d->tableWidget->columns();
125int TableFormatDialog::rows()
const
127 return d->tableWidget->rows();
130int TableFormatDialog::border()
const
132 return d->tableWidget->border();
135void TableFormatDialog::setColumns(
int col)
137 d->tableWidget->setColumns(col);
140void TableFormatDialog::setRows(
int row)
142 d->tableWidget->setRows(row);
145void TableFormatDialog::setBorder(
int border)
147 d->tableWidget->setBorder(border);
150int TableFormatDialog::padding()
const
152 return d->padding->value();
155void TableFormatDialog::setPadding(
int value)
157 d->padding->setValue(value);
160int TableFormatDialog::spacing()
const
162 return d->spacing->value();
165void TableFormatDialog::setSpacing(
int value)
167 d->spacing->setValue(value);
172 d->alignment->setCurrentIndex(d->alignment->findData(
QVariant(alignment)));
177 return static_cast<Qt::Alignment>(d->alignment->itemData(d->alignment->currentIndex()).toInt());
182 return d->tableWidget->typeOfLength();
185int TableFormatDialog::length()
const
187 return d->tableWidget->length();
190void TableFormatDialog::setLength(
int val)
192 d->tableWidget->setLength(val);
197 d->tableWidget->setTypeOfLength(type);
200QColor TableFormatDialog::tableBackgroundColor()
const
202 return d->backgroundColor->color();
205void TableFormatDialog::setTableBackgroundColor(
const QColor &col)
207 d->backgroundColor->setColor(col);
208 d->useBackgroundColor->setChecked(
true);
211bool TableFormatDialog::useBackgroundColor()
const
213 return d->useBackgroundColor->isChecked();
216#include "moc_tableformatdialog.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
void addItem(const QIcon &icon, const QString &text, const QVariant &userData)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)