<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[SOLVED] QtoolBar inside of the Qdockwidget]]></title><description><![CDATA[<p dir="auto">i have read on the net that it is possible to have a toolbar inside of the dockwidget as long as the QmainWindow is set first inside of the dockwidget. below is my modified code that i found on the net. it is my attempt to get the toolbar inside of the dockwidget but it is not working. instead it creates another dockwidget and places the toolbar inside of that.</p>
<p dir="auto">ui-&gt;dockWidget is the widget that i would like to place the toolbar in. your help is greatly appreciated. thank you in advanced.</p>
<p dir="auto">@  QDockWidget* dock = new QDockWidget(ui-&gt;dockWidget);<br />
QMainWindow* inner = new QMainWindow(dock);<br />
inner-&gt;setWindowFlags(Qt::Widget);<br />
QToolBar* toolBar = new QToolBar(inner);<br />
inner-&gt;addToolBar(toolBar);<br />
dock-&gt;setWidget(inner);<br />
this-&gt;addDockWidget(Qt::LeftDockWidgetArea, dock);@</p>
]]></description><link>https://forum.qt.io/topic/9578/solved-qtoolbar-inside-of-the-qdockwidget</link><generator>RSS for Node</generator><lastBuildDate>Mon, 17 Aug 2026 19:39:14 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/9578.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Sep 2011 07:44:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] QtoolBar inside of the Qdockwidget on Tue, 20 Sep 2011 06:01:45 GMT]]></title><description><![CDATA[<p dir="auto">yes, the code gives me the results i want. thank you very much sigrid :)</p>
]]></description><link>https://forum.qt.io/post/110044</link><guid isPermaLink="true">https://forum.qt.io/post/110044</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 Sep 2011 06:01:45 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QtoolBar inside of the Qdockwidget on Mon, 19 Sep 2011 08:22:31 GMT]]></title><description><![CDATA[<p dir="auto">The following "FAQ":<a href="http://developer.qt.nokia.com/faq/answer/how_can_i_embed_e.g_a_qmainwindow_inside_a_qdialog" target="_blank" rel="noopener noreferrer nofollow ugc">http://developer.qt.nokia.com/faq/answer/how_can_i_embed_e.g_a_qmainwindow_inside_a_qdialog</a>  explains how you can embed a QMainWindow inside another widget. I have followed the recommendations from the FAQ when creating the example below. Does the example below give you the result you want?</p>
<p dir="auto">@<br />
#include &lt;QtGui&gt;</p>
<p dir="auto">int main(int argc, char **argv)<br />
{<br />
QApplication app(argc, argv);<br />
QMainWindow mainWindow;<br />
QDockWidget *dock = new QDockWidget(&amp;mainWindow);<br />
mainWindow.addDockWidget(Qt::TopDockWidgetArea, dock);</p>
<p dir="auto">QMainWindow *window = new QMainWindow(0);<br />
QToolBar *bar = new QToolBar(window);<br />
bar-&gt;addAction("First");<br />
window-&gt;addToolBar(bar);</p>
<p dir="auto">QTextEdit *edit = new QTextEdit(window);<br />
window-&gt;setCentralWidget(edit);</p>
<p dir="auto">QMenu *menu = new QMenu("file", window);<br />
menu-&gt;addAction("one");<br />
menu-&gt;addAction("one");<br />
menu-&gt;addAction("one");</p>
<p dir="auto">window-&gt;menuBar()-&gt;addMenu(menu);<br />
window-&gt;setParent(dock);<br />
dock-&gt;setWidget(window);</p>
<p dir="auto">mainWindow.show();<br />
return app.exec();<br />
}</p>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/post/109914</link><guid isPermaLink="true">https://forum.qt.io/post/109914</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 19 Sep 2011 08:22:31 GMT</pubDate></item></channel></rss>