Skip to content
Permalink
Browse files

Use TextSelectableByMouse instead of disabled QLineEdit; rename widge…

…ts to m*
  • Loading branch information
suricactus authored and nyalldawson committed Apr 30, 2020
1 parent 8ff229e commit adbfec1484222727d8cf64525f00855d72326006
Showing with 11 additions and 17 deletions.
  1. +5 −5 src/gui/qgssublayersdialog.cpp
  2. +1 −1 src/gui/qgssublayersdialog.h
  3. +5 −11 src/ui/qgssublayersdialogbase.ui
@@ -88,14 +88,14 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType,
QString filename = QFileInfo( fileFullPath ).fileName();

setWindowTitle( filename.isEmpty() ? title : QStringLiteral( "%1 | %2" ).arg( title, filename ) );
txtFilePath->setText( QDir::toNativeSeparators( QFileInfo( fileFullPath ).canonicalFilePath() ) );
mLblFilePath->setText( QDir::toNativeSeparators( QFileInfo( fileFullPath ).canonicalFilePath() ) );

if ( filename.isEmpty() )
txtFilePath->setVisible( false );
mLblFilePath->setVisible( false );

// add a "Select All" button - would be nicer with an icon
connect( btnSelectAll, &QAbstractButton::pressed, layersTable, &QTreeView::selectAll );
connect( btnDeselectAll, &QAbstractButton::pressed, this, &QgsSublayersDialog::btnDeselectAll_pressed );
connect( mBtnSelectAll, &QAbstractButton::pressed, layersTable, &QTreeView::selectAll );
connect( mBtnDeselectAll, &QAbstractButton::pressed, this, &QgsSublayersDialog::mBtnDeselectAll_pressed );
connect( layersTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsSublayersDialog::layersTable_selectionChanged );

mCbxAddToGroup->setVisible( false );
@@ -238,7 +238,7 @@ void QgsSublayersDialog::layersTable_selectionChanged( const QItemSelection &, c
buttonBox->button( QDialogButtonBox::Ok )->setEnabled( layersTable->selectedItems().length() > 0 );
}

void QgsSublayersDialog::btnDeselectAll_pressed()
void QgsSublayersDialog::mBtnDeselectAll_pressed()
{
layersTable->selectionModel()->clear();
}
@@ -147,7 +147,7 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi

private slots:
void layersTable_selectionChanged( const QItemSelection &, const QItemSelection & );
void btnDeselectAll_pressed();
void mBtnDeselectAll_pressed();

protected:

@@ -54,14 +54,14 @@
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnSelectAll">
<widget class="QPushButton" name="mBtnSelectAll">
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDeselectAll">
<widget class="QPushButton" name="mBtnDeselectAll">
<property name="text">
<string>Deselect All</string>
</property>
@@ -90,18 +90,12 @@
</layout>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="txtFilePath">
<widget class="QLabel" name="mLblFilePath">
<property name="toolTip">
<string>Current file source</string>
</property>
<property name="styleSheet">
<string notr="true">color: #505050;
background-color: #F0F0F0;
border: 1px solid #B0B0B0;
border-radius: 2px;</string>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>

0 comments on commit adbfec1

Please sign in to comment.
You can’t perform that action at this time.