Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
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 |
kavr::kavr() : KParts::MainWindow(0, "kavr") { m_mapper = new QSignalMapper(this); // Create a KMultiTabBar. m_tabBar = new KMultiTabBar(KMultiTabBar::Vertical, this); 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); // 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") ); // Add a layout to the mainwindow. m_layout = new QHBoxLayout(this); m_layout->add(m_tabBar); m_layout->add(m_part->widget() ); m_layout->activate();// If the part was created successfully... if (m_part) { // Tell the mainwindow that this is the mainwidget. setCentralWidget(m_part->widget() ); // Integrate the part's GUI with our mainwindow. createGUI(m_part); } |
Quoted
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,
_
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); } |
Forum Software: Burning Board®, developed by WoltLab® GmbH
Linux Computer - Linux Forum -
Linux Computer und Notebooks - Lastminute - Wasserbetten & Whirlpools