Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UX of layer style categories with html #58729

Merged
merged 9 commits into from
Oct 9, 2024
4 changes: 2 additions & 2 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
const QModelIndex index = model->index( row, 0 );
const QgsMapLayer::StyleCategory category = model->data( index, Qt::UserRole ).value<QgsMapLayer::StyleCategory>();
const QString name = model->data( index, Qt::DisplayRole ).toString();
const QString name = model->data( index, static_cast< int >( QgsMapLayerStyleCategoriesModel::Role::NameRole ) ).toString();
const QString tooltip = model->data( index, Qt::ToolTipRole ).toString();
const QIcon icon = model->data( index, Qt::DecorationRole ).value<QIcon>();
QAction *copyAction = new QAction( icon, name, copyStyleMenu );
Expand Down Expand Up @@ -681,7 +681,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
const QModelIndex index = model->index( row, 0 );
const QgsMapLayer::StyleCategory category = model->data( index, Qt::UserRole ).value<QgsMapLayer::StyleCategory>();
const QString name = model->data( index, Qt::DisplayRole ).toString();
const QString name = model->data( index, static_cast< int >( QgsMapLayerStyleCategoriesModel::Role::NameRole ) ).toString();
const QString tooltip = model->data( index, Qt::ToolTipRole ).toString();
const QIcon icon = model->data( index, Qt::DecorationRole ).value<QIcon>();
QAction *pasteAction = new QAction( icon, name, pasteStyleMenu );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaplayerloadstyledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "qgsapplication.h"
#include "qgsgui.h"


QgsMapLayerLoadStyleDialog::QgsMapLayerLoadStyleDialog( QgsMapLayer *layer, QWidget *parent )
: QDialog( parent )
, mLayer( layer )
Expand Down Expand Up @@ -74,6 +73,7 @@ QgsMapLayerLoadStyleDialog::QgsMapLayerLoadStyleDialog( QgsMapLayer *layer, QWid
const QgsMapLayer::StyleCategories lastStyleCategories = settings.flagValue( QStringLiteral( "style/lastStyleCategories" ), QgsMapLayer::AllStyleCategories );
mModel->setCategories( lastStyleCategories );
mStyleCategoriesListView->setModel( mModel );
mStyleCategoriesListView->setItemDelegate( new CategoryDisplayLabelDelegate( this ) );

// load from file setup
switch ( mLayer->type() )
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsmaplayersavestyledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ QgsMapLayerSaveStyleDialog::QgsMapLayerSaveStyleDialog( QgsMapLayer *layer, QWid
const QgsMapLayer::StyleCategories lastStyleCategories = settings.flagValue( QStringLiteral( "style/lastStyleCategories" ), QgsMapLayer::AllStyleCategories );
mModel->setCategories( lastStyleCategories );
mStyleCategoriesListView->setModel( mModel );
mStyleCategoriesListView->setItemDelegate( new CategoryDisplayLabelDelegate( this ) );

// select and deselect all categories
connect( mSelectAllButton, &QPushButton::clicked, this, &QgsMapLayerSaveStyleDialog::selectAll );
Expand Down
Loading
Loading