Skip to content

Commit

Permalink
Fix ellipsis characters in button text show incorrectly on windows
Browse files Browse the repository at this point in the history
Fixes #33209
  • Loading branch information
nyalldawson committed Dec 11, 2019
1 parent f597f72 commit e2e1bd3
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app/locator/qgsinbuiltlocatorfilters.cpp
Expand Up @@ -178,9 +178,9 @@ void QgsActionLocatorFilter::searchActions( const QString &string, QWidget *pare
tooltip = match.captured( 1 );
}
tooltip.replace( QStringLiteral( "..." ), QString() );
tooltip.replace( QStringLiteral( "" ), QString() );
tooltip.replace( QString( QChar( 0x2026 ) ), QString() );
searchText.replace( QStringLiteral( "..." ), QString() );
searchText.replace( QStringLiteral( "" ), QString() );
searchText.replace( QString( QChar( 0x2026 ) ), QString() );
bool uniqueTooltip = searchText.trimmed().compare( tooltip.trimmed(), Qt::CaseInsensitive ) != 0;
if ( action->isChecked() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -333,7 +333,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
QString source( layer->publicSource() );
if ( source.size() > 1024 )
{
source = source.left( 1023 ) + QStringLiteral( "" );
source = source.left( 1023 ) + QString( QChar( 0x2026 ) );
}

parts << "<i>" + source.toHtmlEscaped() + "</i>";
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingmaplayercombobox.cpp
Expand Up @@ -42,7 +42,7 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessin
layout->setAlignment( mCombo, Qt::AlignTop );

mSelectButton = new QToolButton();
mSelectButton->setText( QStringLiteral( "" ) );
mSelectButton->setText( QString( QChar( 0x2026 ) ) );
mSelectButton->setToolTip( tr( "Select file" ) );
connect( mSelectButton, &QToolButton::clicked, this, &QgsProcessingMapLayerComboBox::triggerFileSelection );
layout->addWidget( mSelectButton );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingmatrixparameterdialog.cpp
Expand Up @@ -146,7 +146,7 @@ QgsProcessingMatrixParameterPanel::QgsProcessingMatrixParameterPanel( QWidget *p
hl->addWidget( mLineEdit, 1 );

mToolButton = new QToolButton();
mToolButton->setText( QStringLiteral( "" ) );
mToolButton->setText( QString( QChar( 0x2026 ) ) );
hl->addWidget( mToolButton );

setLayout( hl );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -1659,7 +1659,7 @@ QgsProcessingEnumPanelWidget::QgsProcessingEnumPanelWidget( QWidget *parent, con
hl->addWidget( mLineEdit, 1 );

mToolButton = new QToolButton();
mToolButton->setText( QStringLiteral( "" ) );
mToolButton->setText( QString( QChar( 0x2026 ) ) );
hl->addWidget( mToolButton );

setLayout( hl );
Expand Down Expand Up @@ -2371,7 +2371,7 @@ QgsProcessingPointPanel::QgsProcessingPointPanel( QWidget *parent )
mLineEdit->setShowClearButton( false );
l->addWidget( mLineEdit, 1 );
mButton = new QToolButton();
mButton->setText( QStringLiteral( "" ) );
mButton->setText( QString( QChar( 0x2026 ) ) );
l->addWidget( mButton );
setLayout( l );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsfilecontentsourcelineedit.cpp
Expand Up @@ -35,7 +35,7 @@ QgsAbstractFileContentSourceLineEdit::QgsAbstractFileContentSourceLineEdit( QWid
mFileLineEdit = new QgsFilterLineEdit( this );
mFileLineEdit->setShowClearButton( true );
mFileToolButton = new QToolButton( this );
mFileToolButton->setText( QStringLiteral( "" ) );
mFileToolButton->setText( QString( QChar( 0x2026 ) ) );
layout->addWidget( mFileLineEdit, 1 );
layout->addWidget( mFileToolButton );
setLayout( layout );
Expand Down

4 comments on commit e2e1bd3

@elpaso
Copy link
Contributor

@elpaso elpaso commented on e2e1bd3 Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I don't find 0x2026 much readable. What's the root cause of this? Can't we tell the compiler to understand utf8?

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any other solution...

@elpaso
Copy link
Contributor

@elpaso elpaso commented on e2e1bd3 Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add a few lines of comment.

@i-s-o
Copy link
Contributor

@i-s-o i-s-o commented on e2e1bd3 Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I don't find 0x2026 much readable. What's the root cause of this? Can't we tell the compiler to understand utf8?

The root cause: QGIS source code is encoded in UTF-8 but VS2015 treats it as whatever the system locale is (unless the file has BOM). A later addition to VS2015, /utf-8, sounds like the compiler option you are asking about, but I couldn't figure out a quick way to test it:
https://docs.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=vs-2015

There is a discussion about this option here: https://bugs.chromium.org/p/chromium/issues/detail?id=637203.

Of course, there may be side effects that need to be watched for.

Please sign in to comment.