24 #include <QTreeWidgetItem>
26 #include <QRadioButton>
34 connect( mGroupButton, &QRadioButton::toggled,
this, &QgsAddTabOrGroup::mGroupButton_toggled );
35 connect( mTabButton, &QRadioButton::toggled,
this, &QgsAddTabOrGroup::mTabButton_toggled );
37 mTabButton->setChecked(
true );
38 mTabList->setEnabled(
false );
39 if ( !
mTabs.isEmpty() )
42 const auto constMTabs =
mTabs;
45 mTabList->addItem(
tab.first, i );
46 if (
tab.second == currentTab )
48 mTabList->setCurrentIndex( i );
49 mGroupButton->setChecked(
true );
56 mGroupButton->setEnabled(
false );
59 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsAddTabOrGroup::showHelp );
61 mColumnCountSpinBox->setValue(
QgsSettings().value( QStringLiteral(
"/qgis/attributeForm/defaultTabColumnCount" ), 1 ).toInt() );
63 setWindowTitle( tr(
"Add Container for %1" ).arg(
mLayer->
name() ) );
79 return mColumnCountSpinBox->value();
84 return mTabButton->isChecked();
89 if ( mColumnCountSpinBox->value() > 0 )
91 if ( mGroupButton->isChecked() )
93 QgsSettings().
setValue( QStringLiteral(
"/qgis/attributeForm/defaultGroupColumnCount" ), mColumnCountSpinBox->value() );
97 QgsSettings().
setValue( QStringLiteral(
"/qgis/attributeForm/defaultTabColumnCount" ), mColumnCountSpinBox->value() );
104 void QgsAddTabOrGroup::mGroupButton_toggled(
bool checked )
106 mTabList->setEnabled( checked );
110 mColumnCountSpinBox->setValue(
QgsSettings().value( QStringLiteral(
"/qgis/attributeForm/defaultGroupColumnCount" ), 1 ).toInt() );
114 void QgsAddTabOrGroup::mTabButton_toggled(
bool checked )
116 mTabList->setEnabled( !checked );
118 mColumnCountSpinBox->setValue(
QgsSettings().value( QStringLiteral(
"/qgis/attributeForm/defaultTabColumnCount" ), 1 ).toInt() );
121 void QgsAddTabOrGroup::showHelp()
123 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/vector_properties.html#the-drag-and-drop-designer" ) );
QgsAddTabOrGroup(QgsVectorLayer *lyr, const QList< TabPair > &tabList, QTreeWidgetItem *currentTab=nullptr, QWidget *parent=nullptr)
constructor
QPair< QString, QTreeWidgetItem * > TabPair
QTreeWidgetItem * tab()
Returns tree item corresponding to the added tab.
void accept() override
Accepts the dialog.
int columnCount() const
Returns the column count.
bool tabButtonIsChecked()
Returns whether the tab button is checked.
QString name()
Returns the name of the tab or group.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
This class is a composition of two QSettings instances:
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Represents a vector layer which manages a vector based data sets.