Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Pb with QAction, QToolBar, QToolButton
Forum Updated to NodeBB v4.3 + New Features

Qt Pb with QAction, QToolBar, QToolButton

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Miky Mike
    wrote on last edited by
    #1

    Hello guys,

    I got a problem here.

    I'm building a Qt app that uses slidingStackedWidgets in order to slide from one page to another one.

    I have 2 toolBars, a topToolBar and a bottomToolBar that do not slide when the central widget moves.

    So I have declared a QAction in my mainWindow.h

    @ QAction *backToMainVert;@

    And in my mainWindow.cpp, when I call the second view by clicking a button, I call a slideInAdd() method that goes like this:
    @
    slidingStacked->slideInIdx(1); //this takes me back to my second page
    backToMainVert = this->topToolBar->addWidget(backBarButton);
    //this adds a backButton to the topToolBar@

    Now the backBarButton is connected to a slideToMain() method which, when triggered takes me back to my first page and removes the backBarButton from the topToolBar

    @ this->topToolBar->removeAction(backToMainVert);
    slidingStacked->slideInIdx(0);@

    The first time I switch to the second page, no problem, my button is created and displayed on my topToolBar.

    When I click the backBarButton, it goes back to the first page.

    BUT the second time I want to return from the first page to the second page, the backBarButton never appears.

    Uh, maybe this can help, here is the way I instantiate my backBarButton :

    @backBarButton = new QToolButton(this);
    backBarButton->setText("Retour");
    backBarButton->setFixedSize(80,30);
    backBarButton->setStyleSheet("background-image: url(:/ToolBarButton.png);"
    "background-repeat: no-repeat;"
    "background-position: center center;"
    "border:0;"
    "color : white;"
    "font-family: System;"
    "font-style: bold;"
    "font-size: 9pt;"
    "color : white;");@

    Any idea what I'm missing here please ?

    Thanks in advance, I'm stuck.

    Miky Mike

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi Mike,

      there is code missing to have more knowledge on your problem:

      how do you slide back and what do you do in that code (esp. with the back button)

      I'm not sure, what removeAction does exactly (with the action and the button)

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved