Skip to content

Commit

Permalink
Use TextSelectableByMouse instead of disabled QLineEdit; rename widge…
Browse files Browse the repository at this point in the history
…ts to m*
  • Loading branch information
suricactus authored and nyalldawson committed May 17, 2020
1 parent 8ff229e commit adbfec1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/gui/qgssublayersdialog.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion src/gui/qgssublayersdialog.h
Expand Up @@ -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:

Expand Down
16 changes: 5 additions & 11 deletions src/ui/qgssublayersdialogbase.ui
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit adbfec1

Please sign in to comment.