21 #include "tablecellformatdialog.h"
23 #include <KColorButton>
25 #include <KLocalizedString>
30 #include <QVBoxLayout>
32 using namespace KPIMTextEdit;
34 class TableCellFormatDialog::TableCellFormatDialogPrivate
37 TableCellFormatDialogPrivate( TableCellFormatDialog *qq )
40 q->setCaption( i18n(
"Cell Format" ) );
41 q->setButtons( Ok|Cancel );
43 q->setMainWidget( page );
47 QLabel *lab =
new QLabel( i18n(
"Vertical Alignment:" ) );
49 verticalAlignment =
new KComboBox;
50 verticalAlignment->addItem( i18n(
"Top" ), QTextCharFormat::AlignTop );
51 verticalAlignment->addItem( i18n(
"Middle" ), QTextCharFormat::AlignMiddle );
52 verticalAlignment->addItem( i18n(
"Bottom" ), QTextCharFormat::AlignBottom );
57 KSeparator *sep =
new KSeparator;
61 useBackgroundColor =
new QCheckBox( i18n(
"Background Color:" ) );
63 backgroundColor =
new KColorButton;
64 backgroundColor->setDefaultColor( Qt::white );
70 backgroundColor->setEnabled(
false );
71 q->connect( useBackgroundColor, SIGNAL(toggled(
bool)),
72 backgroundColor, SLOT(setEnabled(
bool)) );
76 KColorButton *backgroundColor;
77 KComboBox *verticalAlignment;
78 TableCellFormatDialog *q;
81 TableCellFormatDialog::TableCellFormatDialog(
QWidget *parent )
82 : KDialog( parent ), d( new TableCellFormatDialogPrivate( this ) )
86 TableCellFormatDialog::~TableCellFormatDialog()
91 QColor TableCellFormatDialog::tableCellBackgroundColor()
const
93 return d->backgroundColor->color();
96 void TableCellFormatDialog::setTableCellBackgroundColor(
const QColor &col )
98 d->backgroundColor->setColor( col );
99 d->useBackgroundColor->setChecked(
true );
102 QTextCharFormat::VerticalAlignment TableCellFormatDialog::verticalAlignment()
const
105 ( QTextCharFormat::VerticalAlignment )d->verticalAlignment->itemData(
106 d->verticalAlignment->currentIndex () ).toInt();
109 void TableCellFormatDialog::setVerticalAlignment( QTextCharFormat::VerticalAlignment vertical )
111 d->verticalAlignment->setCurrentIndex( d->verticalAlignment->findData(
QVariant( vertical ) ) );
114 bool TableCellFormatDialog::useBackgroundColor()
const
116 return d->useBackgroundColor->isChecked();
void addLayout(QLayout *layout, int stretch)