Hello JPN and thanks for your suggestion.
I will try to make here an example closest as i can to what i'm trying to do.
So first, i have created this .UI, which is the content i want to appear in my tabs:
<ui version="4.0" >
<class>CEditorTab</class>
<widget class="QWidget" name="CEditorTab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>611</height>
</rect>
</property>
<property name="windowTitle" >
<string>Editor Tab</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="txtEditor" >
<property name="font" >
<font>
<family>Monospace</family>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
<antialiasing>true</antialiasing>
<kerning>true</kerning>
</font>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWrapMode" >
<enum>QTextEdit::NoWrap</enum>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>txtEditor</tabstop>
</tabstops>
<resources>
<include location="Artwork/Resources.qrc" />
</resources>
<connections/>
</ui>
<ui version="4.0" >
<class>CEditorTab</class>
<widget class="QWidget" name="CEditorTab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>611</height>
</rect>
</property>
<property name="windowTitle" >
<string>Editor Tab</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="txtEditor" >
<property name="font" >
<font>
<family>Monospace</family>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
<antialiasing>true</antialiasing>
<kerning>true</kerning>
</font>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWrapMode" >
<enum>QTextEdit::NoWrap</enum>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>txtEditor</tabstop>
</tabstops>
<resources>
<include location="Artwork/Resources.qrc" />
</resources>
<connections/>
</ui>
To copy to clipboard, switch view to plain text mode
Then, i have created this .UI, which is a QWidget containing various buttons i want to show on the top right corner of my QTabWidget:
<ui version="4.0" >
<class>CEditorTabButtons</class>
<widget class="QWidget" name="CEditorTabButtons" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Editor Buttons</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>2</number>
</property>
<item row="0" column="5" >
<widget class="QToolButton" name="btnClose" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/RedCross.png</iconset>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QToolButton" name="btnNew" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/NewFile.png</iconset>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QToolButton" name="btnOpen" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/Folder.png</iconset>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QToolButton" name="btnSaveAll" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/SaveAll.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QToolButton" name="btnSave" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/Save.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>118</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="Artwork/Resources.qrc" />
</resources>
<connections/>
</ui>
<ui version="4.0" >
<class>CEditorTabButtons</class>
<widget class="QWidget" name="CEditorTabButtons" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Editor Buttons</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>2</number>
</property>
<item row="0" column="5" >
<widget class="QToolButton" name="btnClose" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/RedCross.png</iconset>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QToolButton" name="btnNew" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/NewFile.png</iconset>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QToolButton" name="btnOpen" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/Folder.png</iconset>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QToolButton" name="btnSaveAll" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/SaveAll.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QToolButton" name="btnSave" >
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="Artwork/Resources.qrc" >:/Images/Save.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>118</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="Artwork/Resources.qrc" />
</resources>
<connections/>
</ui>
To copy to clipboard, switch view to plain text mode
Then i have this class (Which is simplified for the example):
#ifndef CEditorTabBar_h
#define CEditorTabBar_h
#include <QTabWidget>
// This is the little class containing the corner buttons, which i have derived to put some file open / close code in it...
class CEditorTabButtonsImpl;
class CEditorTabImpl;
class CEditorTabBar :
Q_OBJECT
public:
// Constructor.
pButtonsBar = new CEditorTabButtonsImpl(this);
setCornerWidget(pButtonsBar);
}
// Destructor etc also....
cPath);
// Then only slots and signals here.
};
#endif
#ifndef CEditorTabBar_h
#define CEditorTabBar_h
#include <QTabWidget>
// This is the little class containing the corner buttons, which i have derived to put some file open / close code in it...
class CEditorTabButtonsImpl;
class CEditorTabImpl;
class QToolButton;
class QStringList;
class CEditorTabBar :
public QTabWidget {
Q_OBJECT
public:
// Constructor.
CEditorTabBar(QWidget* Parent=0) :
QTabWidget(parent) {
pButtonsBar = new CEditorTabButtonsImpl(this);
setCornerWidget(pButtonsBar);
}
// Destructor etc also....
cPath);
// Then only slots and signals here.
};
#endif
To copy to clipboard, switch view to plain text mode
Then on my main window class, i have code similar to this:
cLittleFont.setPointSize(7);
pEditorTabBar = new CEditorTabBar(this);
pEditorTabBar->setFont(cLittleFont);
setCentralWidget(pEditorTabBar);
QFont cLittleFont;
cLittleFont.setPointSize(7);
pEditorTabBar = new CEditorTabBar(this);
pEditorTabBar->setFont(cLittleFont);
setCentralWidget(pEditorTabBar);
To copy to clipboard, switch view to plain text mode
It creates the Tab Bar, but as shown on pictures on my first thread, the corner buttons are messed up...
Here we are, i hope this will help helping me 
Thanks,
Pierre.
Bookmarks