Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QTabBar : how see only a widget with the name of a tab ?
Forum Updated to NodeBB v4.3 + New Features

QTabBar : how see only a widget with the name of a tab ?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
13 Posts 3 Posters 2.0k 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.
  • B bozo6919

    Hi,
    I have a QTabWidget and I'm searching for display only this (in blue) :
    0_1533118299097_1.PNG
    Does somebody have an idea?
    Thanks for advance.

    K Offline
    K Offline
    koahnig
    wrote on last edited by
    #2

    @bozo6919

    Do you mean only the tab (as it says Empty) and possibly other tabs, when added.
    But the greyish part with the triangle on the right should disappear?

    Vote the answer(s) that helped you to solve your issue(s)

    B 1 Reply Last reply
    0
    • K koahnig

      @bozo6919

      Do you mean only the tab (as it says Empty) and possibly other tabs, when added.
      But the greyish part with the triangle on the right should disappear?

      B Offline
      B Offline
      bozo6919
      wrote on last edited by bozo6919
      #3

      @koahnig

      Yes, just the square blue. not the greyish part with the triangle and the content of this tab, only the square blue

      Sorry for my English ^^'

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bozo6919
        wrote on last edited by
        #4

        Nobody ?

        Sorry for my English ^^'

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deleted372
          wrote on last edited by
          #5

          I think you should take a look at Stylesheets:
          http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bozo6919
            wrote on last edited by
            #6

            It's not what I want
            I want to display only the square blue in the picture

            Sorry for my English ^^'

            K 1 Reply Last reply
            0
            • B bozo6919

              It's not what I want
              I want to display only the square blue in the picture

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #7

              @bozo6919

              I am wondering if there is a misunderstanding.

              The QTabBar suggest that you are looking ultimately for a row of distinguished blue rectancles with labels "Empty", "Tab1", "Tab2" and so on.

              If you want to limit to one tab as in your example, you might on a entirely wrong route.

              Perhaps something like QLabel would fit better?

              Vote the answer(s) that helped you to solve your issue(s)

              B 1 Reply Last reply
              1
              • K koahnig

                @bozo6919

                I am wondering if there is a misunderstanding.

                The QTabBar suggest that you are looking ultimately for a row of distinguished blue rectancles with labels "Empty", "Tab1", "Tab2" and so on.

                If you want to limit to one tab as in your example, you might on a entirely wrong route.

                Perhaps something like QLabel would fit better?

                B Offline
                B Offline
                bozo6919
                wrote on last edited by
                #8

                @koahnig
                no, I'm going to explain what I want :
                First, I have a QMainWindow and inside it, QTabWidget with a QTabbedBar.
                I have an event with QTabbedBar :
                When the user clicked on the tab (the square blue), I want to create a ghost of this tab (only the square blue).
                This ghost has (after) to follow the mouse of the user. (This part of the code worked already)
                Do you understand?

                Sorry for my English ^^'

                K 1 Reply Last reply
                0
                • B bozo6919

                  @koahnig
                  no, I'm going to explain what I want :
                  First, I have a QMainWindow and inside it, QTabWidget with a QTabbedBar.
                  I have an event with QTabbedBar :
                  When the user clicked on the tab (the square blue), I want to create a ghost of this tab (only the square blue).
                  This ghost has (after) to follow the mouse of the user. (This part of the code worked already)
                  Do you understand?

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #9

                  @bozo6919

                  You like to place the ghost anywhere on the screen?

                  Vote the answer(s) that helped you to solve your issue(s)

                  B 1 Reply Last reply
                  0
                  • K koahnig

                    @bozo6919

                    You like to place the ghost anywhere on the screen?

                    B Offline
                    B Offline
                    bozo6919
                    wrote on last edited by
                    #10

                    @koahnig
                    The ghost has to follow the cursor, and when I release the mouse, my widget moves at the same place as the ghost and the ghost is destroyed.

                    Sorry for my English ^^'

                    K 1 Reply Last reply
                    0
                    • B bozo6919

                      @koahnig
                      The ghost has to follow the cursor, and when I release the mouse, my widget moves at the same place as the ghost and the ghost is destroyed.

                      K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #11

                      @bozo6919

                      If your QTabBar has ultimately only one tab to create the ghost, which you are freely moving somewhere as I understand your application now, then the QTabBar is not the right approach.

                      Why not using a QPushButton to create the ghost?

                      The push button could be changed in style to your likings. It will have not the greyish appendix, you are trying to get rid off.

                      Vote the answer(s) that helped you to solve your issue(s)

                      B 1 Reply Last reply
                      1
                      • K koahnig

                        @bozo6919

                        If your QTabBar has ultimately only one tab to create the ghost, which you are freely moving somewhere as I understand your application now, then the QTabBar is not the right approach.

                        Why not using a QPushButton to create the ghost?

                        The push button could be changed in style to your likings. It will have not the greyish appendix, you are trying to get rid off.

                        B Offline
                        B Offline
                        bozo6919
                        wrote on last edited by
                        #12

                        @koahnig
                        Ok, so it's impossible :/
                        Yes I can create a QPushButton for replacing the text thanks

                        Sorry for my English ^^'

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          bozo6919
                          wrote on last edited by
                          #13

                          So, I managed to do this like that:

                          Tabbed::Tabbed(TabbedBar *tabbedBar) : QWidget(nullptr, Qt::FramelessWindowHint)
                          {
                          	QPalette palette;
                          	TabbedView *tabbedBarGhost = createTabGhost(tabbedBar);
                          
                          	palette.setBrush(this->backgroundRole(), QBrush(tabbedBarGhost->tab->grab()));
                          	this->setPalette(palette);
                          	this->setGeometry(tabbedBarGhost->tab->geometry());
                          	this->setWindowOpacity(0.5);
                          	delete tabbedBarGhost;
                          }
                          
                          TabbedView *TabbedGhost::createTabGhost(TabbedBar *tabbedBar)
                          {
                          	TabbedView *tabbedBarGhost = new TabbedView(nullptr);
                          	int index = tabbedBar->currentIndex();
                          	QString text = tabbedBar->tabbedView->tabText(index);
                          	QWidget *widget = new QWidget;
                          
                          	tabbedBarGhost->addTab(widget, text);
                          	tabbedBarGhost->setWindowOpacity(0);
                          	tabbedBarGhost->show();
                          	return tabbedBarGhost;
                          }
                          

                          A TabbedBar is inherit of a QTabBar
                          A TabbedView is inherit of a QTabWidget

                          Sorry for my English ^^'

                          1 Reply Last reply
                          1

                          • Login

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