Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem making gadgets when windowFlag is Qt::FramelessWindowHint
Forum Updated to NodeBB v4.3 + New Features

Problem making gadgets when windowFlag is Qt::FramelessWindowHint

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So i want to create some gadgets, you know like Windows gadgets

    So my code goes somehow like this:
    @QWidget(QApplication::desktop()),
    ui(new Ui::Clock)
    {
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnBottomHint);
    setAttribute(Qt::WA_TranslucentBackground);
    setAttribute(Qt::WA_X11NetWmWindowTypeDock);
    .......@

    The problem i encounter, is when the user presses Show Desktop, i don't recieve any minimize signal to show it again immediatly

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      AFAIK Windows gadgets are small embedded webpages. Using Qt to "fake" them is cumbersome. Why not do it the "official way":http://msdn.microsoft.com/en-us/library/windows/desktop/bb456468.aspx

      Anyway...
      @
      QWidget(QApplication::desktop()), ui(new Ui::Clock)
      @
      I'm not sure what this does. Does it even compile?

      What is Show Desktop? Is it like a button in your app or do you mean the OS functionality to hide all windows? If a user wants to "show desktop" why do you want your app to work against his wish?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        It is not only for Windows 7 or lower, it is also for Windows 8 and Linux

        Yes it compiles great, here is my complete .cpp file:http://paste.ubuntu.com/8708238/
        a simple clock lcd widget..

        It works great, but i have a problem with the Show Desktop..
        Yes Show Desktop is the OS feature that hides everything.. (But remember not also the gadgets)

        If i have the windowflag, Qt::FramelessWindowHint, i don't recieve minimize signal when Show Desktop is pressed. But if i don't add this windowflag i recieve it.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Ah, you didn't paste the first line (Clock::Clock(): ). Now it makes sense ;)

          I don't think what you want to do is possible. The feature is designed to be transparent for the app so you are working against the user AND the OS.

          You might sniff around for certain WM_XXX message combinations in the nativeEvent() method but I doubt there is such that would identify this feature uniquely.

          I know you're just looking for an answer but I will re-raise the questionable nature of it. The designers of the mentioned OSes clearly didn't want you to do that and so you really shouldn't. As for Windows Vista/7 Gadgets even Microsoft decided "it was a bad idea":http://windows.microsoft.com/en-us/windows/gadgets so maybe learn from their mistakes.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            As Microsoft is saying, they removed it because there existed harmfull gadgets

            But i will not allow the user to add gadgets. I will just have my own basic widgets like weather/clock/image slideshow etc.

            As i said, gadgets are part of the Desktop, and they should not hide after Show Desktop has been clicked.

            From the moment i make the Window frameless, it does not receive minimize event (via change event) neither a native event of WM_SIZE when i click Show Desktop. While if the window is not frameless it receives both messages.

            And even if i achieved to receive a message,
            I set a timer, to run every 1 second, show().. if i click Show Desktop, and wait 1 second it will not Show.. it also says that is not minimized.. Something strange happening here..

            The first answer here says it is a qt thing, (http://stackoverflow.com/questions/19716227/qt-working-windows-8-style-frameless-custom-window)

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              bq. gadgets are part of the Desktop, and they should not hide

              Just because you made up this definition of a gadget for yourself doesn't mean the OS or the rest of the world has to agree ;) There is nothing in Win8 or below Vista called gadget. You chose to call that certain functionality that you want but that doesn't make it real or supported by the OS.

              Show Desktop is a "special" feature. From what you 're saying I suspect no window can be show when it's used and it's probably a DWM trick on the OS part. You're out of luck I suppose.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved