26 #include <QPushButton> 29 : QDialog( parent, flags )
35 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QgsLayoutTableBackgroundColorsDialog::buttonBox_accepted );
36 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QgsLayoutTableBackgroundColorsDialog::buttonBox_rejected );
37 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsLayoutTableBackgroundColorsDialog::showHelp );
59 connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked,
this, &QgsLayoutTableBackgroundColorsDialog::apply );
61 setGuiElementValues();
64 void QgsLayoutTableBackgroundColorsDialog::apply()
70 for (
auto checkBoxIt = mCheckBoxMap.constBegin(); checkBoxIt != mCheckBoxMap.constEnd(); ++checkBoxIt )
73 style.
enabled = checkBoxIt.value()->isChecked();
74 if (
QgsColorButton *button = mColorButtonMap.value( checkBoxIt.key() ) )
85 void QgsLayoutTableBackgroundColorsDialog::buttonBox_accepted()
91 void QgsLayoutTableBackgroundColorsDialog::buttonBox_rejected()
96 void QgsLayoutTableBackgroundColorsDialog::showHelp()
98 QgsHelp::openHelp( QStringLiteral(
"print_composer/composer_items/composer_attribute_table.html#appearance" ) );
101 void QgsLayoutTableBackgroundColorsDialog::setGuiElementValues()
106 for (
auto it = mCheckBoxMap.constBegin(); it != mCheckBoxMap.constEnd(); ++it )
108 it.value()->setChecked( mTable->
cellStyle( it.key() )->enabled );
112 button->setEnabled( mTable->
cellStyle( it.key() )->enabled );
119 mDefaultColorButton->setAllowOpacity(
true );
120 mDefaultColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
121 mDefaultColorButton->setShowNoColor(
true );
122 mDefaultColorButton->setNoColorString( tr(
"No Background" ) );
Style odd numbered columns.
A class to display a table in the print layout, and allow the table to span over multiple frames...
Styling option for a layout table cell.
void beginCommand(const QString &commandText, UndoCommand command=UndoNone)
Starts new undo command for this item.
void setCellStyle(CellStyleGroup group, const QgsLayoutTableStyle &style)
Sets the cell style for a cell group.
Style even numbered columns.
const QgsLayoutTableStyle * cellStyle(CellStyleGroup group) const
Returns the cell style for a cell group.
QColor cellBackgroundColor
Cell background color.
void endCommand()
Completes the current item command and push it onto the layout's undo stack.
void update()
Forces a redraw of all child frames.
QgsLayoutTableBackgroundColorsDialog(QgsLayoutTable *table, QWidget *parent=nullptr, Qt::WindowFlags flags=nullptr)
Constructor for QgsLayoutTableBackgroundColorsDialog.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void setBackgroundColor(const QColor &color)
Sets the color used for background of table.
QColor backgroundColor() const
Returns the color used for the background of the table.
bool enabled
Whether the styling option is enabled.
Style even numbered rows.