21#include "tablecellformatdialog.h"
23#include <KColorButton>
25#include <KLocalizedString>
34class TableCellFormatDialog::TableCellFormatDialogPrivate
37 TableCellFormatDialogPrivate( TableCellFormatDialog *qq )
40 q->setCaption( i18n(
"Cell Format" ) );
41 q->setButtons( Ok|Cancel );
42 QWidget *page =
new QWidget( q );
43 q->setMainWidget( page );
44 QVBoxLayout *lay =
new QVBoxLayout( page );
46 QHBoxLayout *hbox =
new QHBoxLayout;
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 );
54 hbox->addWidget( verticalAlignment );
55 lay->addLayout( hbox );
57 KSeparator *sep =
new KSeparator;
58 lay->addWidget( sep );
60 hbox =
new QHBoxLayout;
61 useBackgroundColor =
new QCheckBox( i18n(
"Background Color:" ) );
62 hbox->addWidget( useBackgroundColor );
63 backgroundColor =
new KColorButton;
64 backgroundColor->setDefaultColor( Qt::white );
65 hbox->addWidget( backgroundColor );
69 lay->addWidget( sep );
70 backgroundColor->setEnabled(
false );
71 q->connect( useBackgroundColor, SIGNAL(toggled(
bool)),
72 backgroundColor, SLOT(setEnabled(
bool)) );
74 QCheckBox *useBackgroundColor;
76 KColorButton *backgroundColor;
77 KComboBox *verticalAlignment;
78 TableCellFormatDialog *q;
81TableCellFormatDialog::TableCellFormatDialog( QWidget *parent )
82 : KDialog( parent ), d( new TableCellFormatDialogPrivate( this ) )
86TableCellFormatDialog::~TableCellFormatDialog()
91QColor TableCellFormatDialog::tableCellBackgroundColor()
const
93 return d->backgroundColor->color();
96void TableCellFormatDialog::setTableCellBackgroundColor(
const QColor &col )
98 d->backgroundColor->setColor( col );
99 d->useBackgroundColor->setChecked(
true );
102QTextCharFormat::VerticalAlignment TableCellFormatDialog::verticalAlignment()
const
105 ( QTextCharFormat::VerticalAlignment )d->verticalAlignment->itemData(
106 d->verticalAlignment->currentIndex () ).toInt();
109void TableCellFormatDialog::setVerticalAlignment( QTextCharFormat::VerticalAlignment vertical )
111 d->verticalAlignment->setCurrentIndex( d->verticalAlignment->findData( QVariant( vertical ) ) );
114bool TableCellFormatDialog::useBackgroundColor()
const
116 return d->useBackgroundColor->isChecked();
Copyright (C) 2006 Laurent Montel montel@kde.org Copyright (C) 2008 Thomas McGuire mcguire@kde....