Skip to content
  • 0 Votes
    10 Posts
    2k Views
    L
    I encountered the same problem, and after spending over 6 hours on this, I'm so proud to say that I have a solution! Anyway, there's also an limitation, I'll mention it later. well, in breif, this is it: visualEffect.h: #include <dwmapi.h> // note that you may have to use msvc for this // More friendly names enum EffectType : int { EffectType_Default = DWMSBT_AUTO, EffectType_None = DWMSBT_NONE, EffectType_Mica = DWMSBT_MAINWINDOW, EffectType_Acrylic = DWMSBT_TRANSIENTWINDOW, EffectType_MicaAlt = DWMSBT_TABBEDWINDOW }; enum CornerPreference : int { Corner_Default = DWMWCP_DEFAULT, Corner_NoRound = DWMWCP_DONOTROUND, Corner_Round = DWMWCP_ROUND, Corner_RoundSmall = DWMWCP_ROUNDSMALL }; bool SetAcrylicEffect(HWND hwnd, EffectType type = EffectType_Mica, CornerPreference corner = Corner_Round); visualEffect.cpp #include "visualEffect.h" bool SetAcrylicEffect(HWND hwnd, EffectType type, CornerPreference corner) { if(!hwnd) return false; HRESULT hr1, hr2; DWM_SYSTEMBACKDROP_TYPE backdrop = static_cast<DWM_SYSTEMBACKDROP_TYPE>(type); hr1 = DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdrop, sizeof(backdrop)); // set rounded corner preference if(corner != Corner_Default) { // when it's not default DWM_WINDOW_CORNER_PREFERENCE cp = static_cast<DWM_WINDOW_CORNER_PREFERENCE>(corner); hr2 = DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &cp, sizeof(cp)); } else { hr2 = S_OK; // regard as success } return SUCCEEDED(hr1) && SUCCEEDED(hr2); } You need to link dwmapi like this in your CMakeLists.txt: target_link_libraries(YourApplication PRIVATE dwmapi) Some important things you need to know: Corner_Round is fixed 8px radius, and Corner_RoundSmall is fixed 4px. You can not change this, because this is builtin for dwm. There values are usually good enough, so if you really want it you should just set your window to 8px radius. after using setAttribute(Qt::WA_Translucentbackground), the transparent part for your window is not regarded as the window region, so it acts like non-client area. And if you use the stylesheet or paintEvent on your centralwidget or something, the effect looks broken. So the best approach on Qt, is set another overlay widget at the bottom, and put everything else on top of it. The overlay widget should have something like this: #overlay { background: rgba(255, 255, 255, 2); /*1 makes it not transparent at all, and 0 does not work*/ } and this: // something here { ui->setupUi(this); setAttribute(Qt::WA_TranslucentBackground); if(!SetAcrylicEffect((HWND)this->winId(), EffectType_Acrylic, Corner_Round)) { qWarning() << "Failed to launch Acrylic Effect, fallback to default transparency" << GetLastError(); } } also this: [image: a598cfd7-66a8-4c06-9aaf-15a8b7578bf5.png] And you're done! You can find the full version on my github, but the above one should be completely usable already.
  • 0 Votes
    6 Posts
    1k Views
    B
    One data point about Apple's preference: Safari's Bookmarks menu uses a "globe" icon for pages that lack their own icon, and that monochrome globe icon does switch between light and dark when selected.
  • 0 Votes
    9 Posts
    2k Views
    Christian EhrlicherC
    @csab6597 said in QColorDialog broken becaus of new Windows 11 style spin buttons: Well ok, I definitely expected the final fix to be resizing the spin buttons such that they stack vertically again, as it was before 6.7. No, the windows11 style places them the way it is. So we will now have different spin buttons per operating system, I don't see a problem here - windows 11 looks different than macos, kde or gnome. If you want the same style for every os then hard-code it to fusion style.
  • 0 Votes
    5 Posts
    1k Views
    G
    @Abderrahmene_Rayene smart!
  • Are ListView sections stylable?

    Unsolved QML and Qt Quick listview section style material
    2
    0 Votes
    2 Posts
    818 Views
    L
    @MrMeszaros you can style it anyway you want to. just add wrapper and style it to your liking: section.delegate: Rectangle{ width: parent.width height: childrenRect.height color: "red" required property string section Text { anchors.horizontalCenter: parent.horizontalCenter text: parent.section font.bold: true color: "blue" font.pointSize: 13 } }
  • 0 Votes
    1 Posts
    510 Views
    No one has replied
  • Palette overriding style sheet

    Solved General and Desktop stylesheet palette style
    8
    0 Votes
    8 Posts
    3k Views
    S
    @JonB said in Palette overriding style sheet: Any reason why you didn't use, say, static QPushButton dummyButton; here? I guess I fumbled to long to actually get the style sheet to apply. I tried many different things (because I didn't see this documented anywhere). Must have overlooked this when cleaning up. Thank you! Will fix it in my code.
  • 0 Votes
    2 Posts
    736 Views
    SGaistS
    Hi, I would start by checking if there where any changes to the style classes between the two releases. Also, since you are using 5.15.8, it means you have a commercial license and thus can contact the Qt Company for support.
  • 0 Votes
    5 Posts
    1k Views
    T
    Issue can be found here : https://bugreports.qt.io/browse/QTBUG-98354
  • End of MenuBar not visible if window is not wide enough.

    Unsolved QML and Qt Quick qml menubar style
    1
    0 Votes
    1 Posts
    320 Views
    No one has replied
  • 0 Votes
    4 Posts
    1k Views
    SGaistS
    C++ does not work like that. Create a proper subclass and then use that one for the member variable.
  • Cross platform Qt program GUI library plug-in

    Unsolved Announcements style plugin gui
    1
    0 Votes
    1 Posts
    862 Views
    No one has replied
  • 0 Votes
    3 Posts
    3k Views
    lopeztelL
    Solved it by adding the line qputenv("QT_STYLE_OVERRIDE","Material"); in main.cpp
  • 0 Votes
    8 Posts
    1k Views
    D
    @Nando, @SGaist QPrintPreviewWidget used QGraphicsView in source code so solution in qss is QGraphicsView { qproperty-backgroundBrush: "red"; }
  • 0 Votes
    3 Posts
    759 Views
    T
    As I mentioned, I would like to play with any style, so I guess I'm not able to hardcode use of Material style.
  • 0 Votes
    2 Posts
    3k Views
    Christian EhrlicherC
    @xintrea said in How to recognize padding for a QTableView table item?: not the default style. Only the stylesheet style provides a padding (see box model), all other styles don't have a 'padding' value at all. So what do you want exactly (and why)?
  • QML proper using nested functions

    Unsolved QML and Qt Quick qml function nested style button
    2
    0 Votes
    2 Posts
    908 Views
    rrlopezR
    Hi @Kyeiv, I just did a quick test application and it worked for me: main.qml import QtQuick 2.9 import QtQuick.Window 2.2 import "someJSscriptFile.js" as Jss Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: rect color: Jss.getCurrentColor() anchors.fill: parent } } someJSScriptFile.js function getCurrentColor() { return __getColor(rect.currentValue) } function __getColor(value) { if (rect.pressed) { return "grey" } if(rect.activated === false) { return "white" } if(value ===0) { return "red"; } return "green"; } Is the variable "control" defined in your QML? Or what are you trying to use it for?
  • Theme enum for custom styles?

    Unsolved QML and Qt Quick qml controls 2 theme style
    1
    0 Votes
    1 Posts
    558 Views
    No one has replied
  • lines around Imagine style assets [maybe only Android]

    Solved QML and Qt Quick qml imagine style
    6
    0 Votes
    6 Posts
    2k Views
    jpnurmiJ
    First, you need to download the plugin... in a way or another. :) You can, for example, clone the qt/qtquickcontrols2.git repo, or grab qtquickcontrols2-everywhere-src-5.10.1.zip from download.qt.io. Then, browse to src/imports/controls/imagine/design and double click 9-patch-export.sketchplugin. Sketch should inform that the 9-patch export plugin has been installed. You can export individual image assets from the Export pane, or export all exportable image assets with the Export tool button in the top right corner. The script callback gets called either way, and 9-patch image assets are simply detected by the ".9" suffix in the image asset export names. PS. Yeah, the whole process should be documented and there should be a simple download link in the docs. I guess somebody forgot something. :)