CodePudding user response:
By the way, no master BBS?CodePudding user response:
I also want to know about this recently, single set label styleCodePudding user response:
Access to a single pointer, a use stylesheet SettingsCodePudding user response:
Can post access pointer code it show? I believe this will help a lot of people but in one case, even if get a pointer, the label is not QWidget subclasses, does not necessarily have setStyleSheet () the member functionCodePudding user response:
Is certainly QWidget class, not QWidget subclasses can't display, QTabBar should be the whole bar, rather than a label, see the QTabWidget source discovered that in fact it is only a QTabBar pointer, always thought that a label is a QTabBar, actually should be n label is also a QTabBar, QTabBar is a combination of all tags in the QTabWidget, function QTabBar * QTabWidget: : tabBar () can get QTabBar pointer, but this function is protected, so must to inherit a QTabWidget can obtain the pointer, obtain the QTabWidget pointer is used after the at (int index) should be able to obtain a single pointerCodePudding user response:
I tried n the way I think you put the "label" and "tabs" disturb the two concepts I mean a single tag is not QWidget subclasses, and not to say that QTabBar not QWidget subclass carefully study the QTabBar will actually found a lot of strange things, such as: create a tabBar and addTab again, and then use the following code tabBar - & gt; SetTabsClosable (true); QObject * button=tabBar - & gt; The children (). At (0); TextEdit - & gt; Append (button - & gt; MetaObject () - & gt; The className ()); Will find that each label are the close button on the CloseButton class, but I found that don't have any CloseButton class in qt, later I found that it is the custom, for example: inherited from the QAbstractButton class to create a tabBar, then addTab once, and then use the following code tabBar - & gt; SetTabsClosable (true); TextEdit. Append (QString: : number (tabBar - & gt; The children (). The count ())); You'll find that at this point, a total of three tabBar child controls one of them is the CloseButton on the label, the other two are ToolButton, is the two buttons that make tags around mobile didn't find information about a single tag, let alone a single tag for the pointer now I don't even know, what is a single tag class inherits from what class also don't knowCodePudding user response:
Again, for example: just said the close button on each label is that CloseButton, then I hope to find each CloaeButton button on the label of the Parent information to find information on the label but only to find that the Parent is QTabBar CloseButton, rather than a single label my original idea is: the CloseButton Parent is the label and label is the Parent TAB bar but it happened that the CloseButton Parent is the TAB bar, middle don't have any thing about the labelCodePudding user response:
Actually to obtain the QTabWidget QTabBar pointer without inheritance so trouble as long as QTabBar * tabBar=tabWidget - & gt; FindChildrenCodePudding user response:
That is basically impossible to QTabBar TAB individually styled?CodePudding user response:
I think Qt should not be so silly, QTabBar itself is QWidget, see setTabButton one method, should be able to set each TAB widget items, used, can try styled independently,