Originally posted by anda_skoa
Usually MainWindows already have a layout.
Try creating a QFrame, using it as the CentralWidget and add the two other widgets and your layout to the frame
Cheers,
_
Thanks for the tip, however I can't get it to work properly.
I tried to do what you suggested, it's possible that I misunderstood you though:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
kavr::kavr()
: KParts::MainWindow(0, "kavr")
{
m_mapper = new QSignalMapper(this);
m_mainFrame = new QFrame(this);
// Tell the mainwindow that this is the mainwidget.
setCentralWidget(m_mainFrame);
// Set the shell's ui file.
setXMLFile("kavr_shell.rc");
// Setup our actions.
setupActions();
// Load the appropriate library.
KLibFactory *factory = KLibLoader::self()->factory("libkyzispart");
// Cast the KPart to a KtextEditor::Editor.
m_part = static_cast<KTextEditor::Editor*>(factory->create(this, "ktexteditor_part", "KTextEditor::Editor") );
if (m_part)
{
// Create a KMultiTabBar.
m_tabBar = new KMultiTabBar(KMultiTabBar::Vertical, this->centralWidget() );
m_tabBar->setPosition(KMultiTabBar::Left);
// Create a tab.
m_tabBar->appendTab(0, -2, "Files");
QWidget *tab = m_tabBar->tab(-2);
m_tabBar->showActiveTabTexts(true);
m_tabBar->setTab(-2, true);
// Add a layout to the mainwindow.
m_layout = new QHBoxLayout(m_mainFrame);
m_layout->add(m_tabBar);
m_layout->add(m_part->widget() );
m_layout->activate();// If the part was created successfully...
// Integrate the part's GUI with our mainwindow.
createGUI(m_part);
}
|
Thanks again,
Per