Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-130160

Titlebar of the window isn't draggable if it's made transparent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8.0
    • GUI: Window management
    • None
    • Macbook Pro
    • macOS

    Description

      My objective is to modify the window's 'title bar' to be 'transparent' and allow the content to occupy the space of the 'title bar'. The code(mentioned below) that I've used to achieve my objective works as expected in Qt 5.15.13 but does not function properly in Qt 6.8.0.

      This is a blocker in the process of migrating our app from Qt5 to Qt6.

       

      #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      #endif
      QGuiApplication app(argc, argv);
      
      
      QQmlApplicationEngine engine;
      const QUrl url(QStringLiteral("qrc:/main.qml"));
      QObject::connect(
      &engine,
      &QQmlApplicationEngine::objectCreated,
      &app,
      [url](QObject *obj, const QUrl &objUrl) {
      if (!obj && url == objUrl)
      QCoreApplication::exit(-1);
      },
      Qt::QueuedConnection);
      engine.load(url);
      
      
      QQuickWindow* _rootwin = static_cast<QQuickWindow*>(engine.rootObjects().constFirst());
      NSView *nativeView = reinterpret_cast<NSView *>(_rootwin->winId());
      NSWindow* nativeWindow = [nativeView _rootwin];
      [nativeWindow setStyleMask:[nativeWindow styleMask] | NSWindowStyleMaskFullSizeContentView];
      [nativeWindow setTitlebarAppearsTransparent:YES];

       

       

      Attachments

        1. Qt - 6.8.0.mov
          424 kB
          Abhishek Negi
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            abhisheknegi Abhishek Negi
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes