<?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[Create Custom Window, with custom TitleBar]]></title><description><![CDATA[<p dir="auto">Hi guys, I'm struggling a lot in creating a FramelessWindow which can be attached with a custom Titlebar (that is a custom widget derived from QWidget).</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/15bf8c1c-32e7-4156-8c5d-e924daee0007.png" alt="be1b4a49-ec0a-4003-a3fd-9974d4de24c0-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">the top red-rectangle is my custom Titlebar Widget  (called in the project as "WindowFrame") which has a cunstructor that accept 2 QString for setting the parameter to the Profile_banner and the QWidget* parent parameter as illustrated here:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/8a08e364-5617-48ee-a54f-c0dfcfae7dc5.png" alt="7d1b4cc9-cfc6-4bf0-b52f-bee894c08c71-image.png" class=" img-fluid img-markdown" /> .</p>
<p dir="auto">this is a stand alone Qt project  with is own ".pro" file.<br />
I have another project directory where I have this UI:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/c9f9a802-039b-4ed3-a571-30baaf436c44.png" alt="3a5cd9cf-00e4-4679-b4ea-551a2907e710-image.png" class=" img-fluid img-markdown" /><br />
<img src="https://ddgobkiprc33d.cloudfront.net/e25ac54d-fd41-4982-9c90-a63cae2ff8ba.png" alt="0158cc75-31e2-46ed-bdda-d693a7398297-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">My Plan was:</p>
<ul>
<li>INCLUDEPATH += "the path to my CustomTitleBar" to my <a href="http://TrackManager.pro" target="_blank" rel="noopener noreferrer nofollow ugc">TrackManager.pro</a> file</li>
<li>Create an instance of WindowFrame as a member</li>
<li>In the constructor for TrackManager, retrive the verticalBoxLayout and add it at the top.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/5591312d-82b0-4bbe-b528-36067bd8cb98.png" alt="b926bb4b-b6f6-44e2-a970-c49d90774e34-image.png" class=" img-fluid img-markdown" /></li>
</ul>
<p dir="auto">but when I run the program, give me an error saing: <img src="https://ddgobkiprc33d.cloudfront.net/06dc1431-58e3-4c3b-94f2-8af335e9dbce.png" alt="6add13d9-5d60-44e1-8292-abd90bb16d8d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>My question is: What is the smartest and optimal approch to create a custom Window with Interchangable TitleBar ?</strong></p>
<p dir="auto">I use C++17 , Qt Creator Latest version, and MinGW64 for building.</p>
]]></description><link>https://forum.qt.io/topic/158968/create-custom-window-with-custom-titlebar</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 02:29:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/158968.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Oct 2024 10:51:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Fri, 28 Aug 2026 04:14:22 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
Please check out my custom designed frameless window:<br />
<a href="https://github.com/umar-masood/QtNovaFramelessWindow" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/umar-masood/QtNovaFramelessWindow</a></p>
]]></description><link>https://forum.qt.io/post/839891</link><guid isPermaLink="true">https://forum.qt.io/post/839891</guid><dc:creator><![CDATA[UmarAli]]></dc:creator><pubDate>Fri, 28 Aug 2026 04:14:22 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Wed, 02 Oct 2024 11:30:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrea_venturelli">@<bdi>Andrea_Venturelli</bdi></a> said in <a href="/post/811099">Create Custom Window, with custom TitleBar</a>:</p>
<blockquote>
<p dir="auto">On the other hand, I still struggle understanding how to create a custom-reusable-widget, which i defined its own stylesheet, but after it become a child widget, it will lose all the top level styling and only the components style will be applied (es. QPushButton, QLabel ecc..) because Qt erase the top level QWidget stylesheet for optimization purpose, or at least this is what I understand from reading posts</p>
</blockquote>
<p dir="auto">Normally the last set and more specific settings should apply.</p>
<p dir="auto">See here:</p>
<ul>
<li><a href="https://doc.qt.io/qt-6/stylesheet-syntax.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-syntax.html</a>
<ul>
<li><a href="https://doc.qt.io/qt-6/stylesheet-syntax.html#conflict-resolution" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-syntax.html#conflict-resolution</a></li>
<li><a href="https://doc.qt.io/qt-6/stylesheet-syntax.html#cascading" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-syntax.html#cascading</a></li>
<li><a href="https://doc.qt.io/qt-6/stylesheet-syntax.html#inheritance" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-syntax.html#inheritance</a></li>
</ul>
</li>
</ul>
]]></description><link>https://forum.qt.io/post/811108</link><guid isPermaLink="true">https://forum.qt.io/post/811108</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Wed, 02 Oct 2024 11:30:16 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Wed, 02 Oct 2024 10:06:12 GMT]]></title><description><![CDATA[<p dir="auto">The problem I had at the beginning was solved by including ALL the custom widget I had created ( file.h, file.cpp, file.ui) inside the final project directory;</p>
<p dir="auto">To do so, you need to edit your final project "<a href="http://file.pro" target="_blank" rel="noopener noreferrer nofollow ugc">file.pro</a>" and add the folder's paths where your custom widget live like so</p>
<p dir="auto">"<br />
<strong>inside .pro file</strong><br />
INCLUDEPATH += " insert/path/toyour/customWidgets "<br />
"<br />
After that, you can select "add existing file" directly from the Projects panel<br />
<img src="https://ddgobkiprc33d.cloudfront.net/193930fb-417e-41d5-8e4b-9cedb309f5b3.png" alt="306580a4-e3d8-47a7-8219-e9bcd3351b00-image.png" class=" img-fluid img-markdown" /> .</p>
<p dir="auto">On the other hand, I still struggle understanding how to create a custom-reusable-widget, which i defined its own stylesheet, but after it become a child widget, it will lose all the top level styling and only the components style will be applied (es. QPushButton, QLabel ecc..) because Qt erase the top level QWidget stylesheet for optimization purpose, or at least this is what I understand from reading posts</p>
]]></description><link>https://forum.qt.io/post/811099</link><guid isPermaLink="true">https://forum.qt.io/post/811099</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Wed, 02 Oct 2024 10:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 14:37:08 GMT]]></title><description><![CDATA[<p dir="auto">the code is now working, seems one .cpp was still missed. but now I have this new problem where I loose che color background of the WindowFrame.</p>
<p dir="auto">I Tryed removing the "backgroung-color" from the stylesheet of the WindowFrame.ui and replace it with "transparent".<br />
After that I Tryed  addign the stylesheet directly to the component and also to the TrackManager.ui targeting the WindowFrame {}</p>
<p dir="auto">this is the result:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/fd236164-e3ea-4f22-b239-eccaaaf9fcad.png" alt="image.png" class=" img-fluid img-markdown" /></p>
<pre><code>#include "trackmanager.h"
#include "ui_trackmanager.h"

TrackManager::TrackManager(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::TrackManager)
{
    ui-&gt;setupUi(this);

    QString TEMP_USER{"genericmail@gmail.it"};
    QString TEMP_POWER{"Admin"};

    /*  Declaration status bar &amp; title window  */
    m_statusbar = new QStatusBar();
    m_titlebar = new WindowFrame(TEMP_USER, TEMP_POWER, this);
    m_titlebar-&gt;setStyleSheet("QWidget { background-color: \"#9b0000\";}");
    connect(m_titlebar, &amp;WindowFrame::maximizedClicked, this, &amp;QWidget::showMaximized);
    connect(m_titlebar, &amp;WindowFrame::minimizedClicked, this, &amp;QWidget::showMinimized);

    QVBoxLayout* window_layout = qobject_cast&lt;QVBoxLayout*&gt;(this-&gt;layout());
    window_layout-&gt;insertWidget(0, m_titlebar);
    window_layout-&gt;insertWidget(2, m_statusbar);
}
</code></pre>
<pre><code>QWidget
{
	background-color: "#7e7474";
}


#toolbar_wdg
{
	background-color: "#883d3d";
	border-radius: 12;
}


QToolButton
{
	background-color: white;
	border-radius: 8;
	border: 2 solid transparent;

	outline: 0;
}

QToolButton:checked
{
	background-color: rgb(239, 99, 102);
}

QToolButton:hover
{
	border-color:  rgb(56, 132, 255);
}

WindowFrame QWidget
{
	background-color: red;
}
</code></pre>
]]></description><link>https://forum.qt.io/post/811053</link><guid isPermaLink="true">https://forum.qt.io/post/811053</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Tue, 01 Oct 2024 14:37:08 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 13:18:17 GMT]]></title><description><![CDATA[<p dir="auto">I set-up a gitHub account, here the code<br />
<a href="https://github.com/aVenturelli-qt/custom_app" target="_blank" rel="noopener noreferrer nofollow ugc">GitHub-repository</a></p>
]]></description><link>https://forum.qt.io/post/811045</link><guid isPermaLink="true">https://forum.qt.io/post/811045</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Tue, 01 Oct 2024 13:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 12:58:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> I tryed deleting the Built folder and re-built but gave me the same error.</p>
<p dir="auto">I was tring to share the code but the page gave me the error of "spam message"</p>
]]></description><link>https://forum.qt.io/post/811044</link><guid isPermaLink="true">https://forum.qt.io/post/811044</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Tue, 01 Oct 2024 12:58:42 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 12:47:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrea_venturelli">@<bdi>Andrea_Venturelli</bdi></a> said in <a href="/post/811041">Create Custom Window, with custom TitleBar</a>:</p>
<blockquote>
<p dir="auto">:-1: error: debug/windowframe.o:windowframe.cp:(.rdata$.refptr._ZTV11WindowFrame[.refptr._ZTV11WindowFrame]+0x0): undefined reference to `vtable for WindowFrame'</p>
</blockquote>
<ul>
<li>Clean everything out of build output directory and rebuild.</li>
<li>Does your <code>WindowFrame</code> class have/need <code>Q_OBJECT</code> macro?</li>
</ul>
]]></description><link>https://forum.qt.io/post/811043</link><guid isPermaLink="true">https://forum.qt.io/post/811043</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 01 Oct 2024 12:47:49 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 12:44:25 GMT]]></title><description><![CDATA[<p dir="auto">guys I added the .cpp file to the "SOURCE" param of the ".pro" file and now the error message has changed to the following:</p>
<pre><code class="language-collect2.exe:-1:">C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/windowframe.o: in function `WindowFrame::on_maximize_tbnt_clicked()':
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: debug/windowframe.o: in function `WindowFrame::on_minimize_tbtn_clicked()':
collect2.exe: error: ld returned 1 exit status
C:\Users\path\Qt_c++\TrackInspector\windowframe.cpp:50: error: undefined reference to `WindowFrame::showNormalClicked()'
:-1: error: C:\Users\path\Qt_c++\TrackInspector\build\Desktop_Qt_6_7_1_MinGW_64_bit-Debug/../../windowframe.cpp:54: undefined reference to `WindowFrame::maximizedClicked()'
C:\Users\path\Qt_c++\TrackInspector\windowframe.cpp:61: error: undefined reference to `WindowFrame::minimizedClicked()'
:-1: error: debug/windowframe.o:windowframe.cp:(.rdata$.refptr._ZTV11WindowFrame[.refptr._ZTV11WindowFrame]+0x0): undefined reference to `vtable for WindowFrame'
:-1: error: [Makefile.Debug:83: debug/TrackInspector.exe] Error 1
</code></pre>
<p dir="auto">My .pro file look like this now:</p>
<pre><code>QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    trackmanager.cpp \
    windowframe.cpp

HEADERS += \
    ../TitleCustomBar/profilebanner.h \
    trackmanager.h
    windowframe.h

FORMS += \
    ../TitleCustomBar/profilebanner.ui \
    ../TitleCustomBar/windowframe.ui \
    trackmanager.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    resource.qrc

INCLUDEPATH += "C:\Users\path\Qt_c++\TitleCustomBar"

</code></pre>
]]></description><link>https://forum.qt.io/post/811041</link><guid isPermaLink="true">https://forum.qt.io/post/811041</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Tue, 01 Oct 2024 12:44:25 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 11:44:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrea_venturelli">@<bdi>Andrea_Venturelli</bdi></a></p>
<p dir="auto">Hi,</p>
<p dir="auto">if you have multiple and different "title bar" widgets, which you want to show depending on your configuration or user, looking at the <code>Document Viewer</code> example may help.<br />
This project uses different viewer widgets (loaded as Qt plugin library) for each context of the app</p>
<ul>
<li><a href="https://doc.qt.io/qt-6/qtdoc-demos-documentviewer-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qtdoc-demos-documentviewer-example.html</a></li>
</ul>
<p dir="auto">Try this, when you have multiple title bar widgets, or you simply include the one class in your app like <a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said.</p>
]]></description><link>https://forum.qt.io/post/811033</link><guid isPermaLink="true">https://forum.qt.io/post/811033</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 01 Oct 2024 11:44:17 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 10:59:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrea_venturelli">@<bdi>Andrea_Venturelli</bdi></a> Again: you need WindowFrame.cpp. You have to add it to SOURCES.<br />
And please post error messages and code as text not pictures.</p>
]]></description><link>https://forum.qt.io/post/811029</link><guid isPermaLink="true">https://forum.qt.io/post/811029</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 01 Oct 2024 10:59:28 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 10:57:02 GMT]]></title><description><![CDATA[<p dir="auto">sorry, I only include the directory where all the .cpp, .h and .ui is located.. what I need to do to my ".pro" file ?<br />
<img src="https://ddgobkiprc33d.cloudfront.net/70445071-21de-420d-9cd6-6f17929a29f4.png" alt="image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/811028</link><guid isPermaLink="true">https://forum.qt.io/post/811028</guid><dc:creator><![CDATA[Andrea_Venturelli]]></dc:creator><pubDate>Tue, 01 Oct 2024 10:57:02 GMT</pubDate></item><item><title><![CDATA[Reply to Create Custom Window, with custom TitleBar on Tue, 01 Oct 2024 10:54:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrea_venturelli">@<bdi>Andrea_Venturelli</bdi></a> said in <a href="/post/811024">Create Custom Window, with custom TitleBar</a>:</p>
<blockquote>
<p dir="auto">INCLUDEPATH += "the path to my CustomTitleBar" to my <a href="http://TrackManager.pro" target="_blank" rel="noopener noreferrer nofollow ugc">TrackManager.pro</a> file</p>
</blockquote>
<p dir="auto">This is not enough: you also need the cpp file. Without it you get the error you posted.</p>
]]></description><link>https://forum.qt.io/post/811026</link><guid isPermaLink="true">https://forum.qt.io/post/811026</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 01 Oct 2024 10:54:43 GMT</pubDate></item></channel></rss>