Forum
Sign Up

QTitanRibbon seems to break the windowModified property in QWidget

3 months 1 week ago #1 by Mathias
Hi,

QWidget has the property windowModified, which can be used to indicate, if a widget has been changed. If the property is true, an asterisk * can be shown in the window title by adding the placeholder [*] to the window title. See qt docu: doc.qt.io/qt-6/qwidget.html#windowModified-prop

However, if the QTitanRibbon is used, this mechanism does not work anymore. The window title always shows the full placeholder no matter what the value of windowModified is. Here is a small example that produces the issue.
Clicking the "Modify" button should show the asterisk in the window title, clicking "Save" should remove the asterisk. But this does not work, the placeholder [*] is always shown (see attached screenshot).
#include <QApplication>
#include <QGroupBox>
#include <QToolButton>
#include <QVBoxLayout>

#include <QtitanRibbon.h>
#include <QtnRibbonMainWindow.h>

class MainWindow : public RibbonMainWindow
{
  Q_OBJECT

 public:
  MainWindow()
      : RibbonMainWindow()
  {
    auto groupBox = new QGroupBox( "Buttons", this );

    auto button1 = new QToolButton( this );
    button1->setText( "Modify" );
    connect( button1, &QToolButton::clicked, this, [ this ]() { setWindowModified( true ); } );

    auto button2 = new QToolButton( this );
    button2->setText( "Save" );
    connect( button2, &QToolButton::clicked, this, [ this ]() { setWindowModified( false ); } );

    QVBoxLayout* vLayout = new QVBoxLayout;
    vLayout->addWidget( button1 );
    vLayout->addWidget( button2 );

    groupBox->setLayout( vLayout );

    setCentralWidget( groupBox );

    ribbonBar()->addPage( tr( "First Page" ) );
    ribbonBar()->setFrameThemeEnabled( true );

    setWindowTitle( tr( "TableView Test[*] - asd" ) );
    setWindowModified( false );
  }
};

int main( int argc, char* argv[] )
{
  QApplication app( argc, argv );
  MainWindow mw;
  mw.resize( 640, 480 );
  mw.show();
  return app.exec();
}

#include "main.moc"

Removing the 2 lines
    ribbonBar()->addPage( tr( "First Page" ) );
    ribbonBar()->setFrameThemeEnabled( true );
makes the windowModified property work as expected.

This was tested with Qt 6.5.2 for QTitanRibbon 6.5 and 6.7 on Ubuntu 22.04 and Windows 10.

Is there an option in QTitanRibbon that has to be set, to make this work? Or is this a bug?
Attachments:

Please Log in or Create an account to join the conversation.

More
3 months 4 days ago #2 by Developer Machines
Thank you for the detailed bug-report. It is a bug and it will be fixed in the next update.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #3 by Mathias
The modified indicator works in QTitanRibbon 6.8. Thanks!

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.179 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )