Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4588532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:56:08+00:00 2026-05-21T21:56:08+00:00

Qt project on Mac OS X. I need to show notification window on top

  • 0

Qt project on Mac OS X. I need to show notification window on top without stealing a focus from any active application.

Here the widget constructor part:

setWindowFlags(
    Qt::FramelessWindowHint |
    Qt::WindowSystemMenuHint |
    Qt::Tool |
    Qt::WindowStaysOnTopHint
);
setAttribute(Qt::WA_TranslucentBackground);

Qt::WA_ShowWithoutActivating doesn’t affect anything.

Is there a way to do that? I’m ready to implement the native Carbon/Cocoa solution there, but Qt is preferred.
Or maybe I’m wrong in Mac philosophy and I should notify user in a kind another manner?

Update Growl doesn’t support editor line in its notifications, does it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:56:08+00:00Added an answer on May 21, 2026 at 9:56 pm

    I did it!

    #ifdef Q_OS_MAC
    #include <Carbon/Carbon.h>
    #endif
    
    NotifyWindow::NotifyWindow() : QWidget(0 /* This zero is the first point */) {
    
        setWindowFlags(
        #ifdef Q_OS_MAC
            Qt::SubWindow | // This type flag is the second point
        #else
            Qt::Tool |
        #endif
            Qt::FramelessWindowHint |
            Qt::WindowSystemMenuHint |
            Qt::WindowStaysOnTopHint
        );
        setAttribute(Qt::WA_TranslucentBackground);
    
        // And this conditional block is the third point
    #ifdef Q_OS_MAC
        winId(); // This call creates the OS window ID itself.
                 // qt_mac_window_for() doesn't
    
        int setAttr[] = {
            kHIWindowBitDoesNotHide, // Shows window even when app is hidden
    
            kHIWindowBitDoesNotCycle, // Not sure if required, but not bad
    
            kHIWindowBitNoShadow, // Keep this if you have your own design
                                  // with cross-platform drawn shadows
            0 };
        int clearAttr[] = { 0 };
        HIWindowChangeAttributes(qt_mac_window_for(this), setAttr, clearAttr);
    #endif
    }
    

    We get almost the same nice behavior as in Windows:

    • It does not stole focus on show. (Two weeks of searching over the Internet)
    • The controls there handle the first user click, while other windows need an extra click to activate.
    • When the window is being activated, the other windows of the same application, do not bubble up to the front.
    • And a small problem remains, but at least it has a simple workaround. Or even could be left.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently in a project that need to work both on Mac and Windows.
I need to draw an image in mac os project. In iOS I can
I am a .Net developer who need to port a small project into Mac,
For a project I am doing, I want the Mac application to accept plug-ins.
I've just switched from Windows to Mac and need to find a few tools
I have a project that targets both Mac OS X 10.4 and 10.5, where
I run Flex Builder 3 on a mac and as my project grows -
In Xcode 3.2.1 on Mac OS X Snow Leopard, I open a project under:
Project layout: /project_a /shared /project_b /shared /shared project_a and project_b both need to contain
Every project invariably needs some type of reporting functionality. From a foreach loop in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.