Forum
Sign Up

QTitanRibbon 7: RibbonGroup::addAction does not work from Qt slot

1 month 2 weeks ago #1 by Mathias
I am trying QTitanRibbon 7.0.0 and have an issue, where I can not add a new button to an existing RibbonPage using a Qt connect.

Here is a small example.
#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( "Test", this );

    auto button1 = new QToolButton( this );
    button1->setText( "Add button to Ribbon" );

    connect( button1, &QToolButton::clicked, this, [ this ]() {
      RibbonGroup* group = ribbonBar()->page( 0 )->addGroup( "New Group" );

      auto action2 = new QAction( "Button2", this );
      connect( action2, &QAction::triggered, this, []() { qDebug() << "Button2"; } );
      group->addAction( action2, Qt::ToolButtonTextUnderIcon );
    } );

    auto vLayout = new QVBoxLayout;
    vLayout->addWidget( button1 );

    groupBox->setLayout( vLayout );

    setCentralWidget( groupBox );

    {
      auto page = ribbonBar()->addPage( tr( "Page1" ) );
      RibbonGroup* group1 = page->addGroup( tr( "Group1" ) );
      ribbonBar()->setFrameThemeEnabled( true );

      auto action1 = new QAction( "Button1", this );
      connect( action1, &QAction::triggered, this, []() { qDebug() << "Button1"; } );
      group1->addAction( action1, Qt::ToolButtonTextUnderIcon );
    }

    setWindowTitle( tr( "MissingButton Test" ) );
  }
};

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

#include "main.moc"


The example contains a Ribbon with 1 page with 1 group containing Button1. There is also a button "Add button to Ribbon" in the central widget of the GUI. When this button is clicked, it should add an additional RibbonGroup "New Group" containing Button2 to RibbonPage1.

This works with QTitanRibbon 6.8.0 ("New Group" and Button2 are created, when clicking "Add button to Ribbon"). See Screenshot1.


With QTitanRibbon 7.0.0 it does not work (on WIndows and Ubuntu 24.04). "New Group" is created, but Button2 is missing. See Screenshot2.

Is this a bug in QTitanRibbon 7.0.0?
Attachments:

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

More
2 weeks 3 days ago #2 by Developer Machines
Thank you so much for the bug-report. Bug has been reproduced and will be fixed in the next update.

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.115 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 )