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. QLabel & Win32 native handle
Forum Updated to NodeBB v4.3 + New Features

QLabel & Win32 native handle

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 4.2k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Isn't "winId":http://qt-project.org/doc/qt-5/qwindow.html#winId what you are looking for ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

      Hi, thanks to reply !
      I want use the following acad/Objectarx function:

      acdbDisplayPreviewFromDwg(ACHAR*, void*, Adesk::UInt32*)

      to display a dwg thumbnail on a dialog; with MFC it works if I set the
      second parameter to the HWND of a 'Picture Control' or 'Text Control'.
      But I love QT :) and I want use QWinWidget and QTDialog ...

      Your suggest doesn't works:

      b = acdbDisplayPreviewFromDwg(result->resval.rstring, (HWND)qLab->winId(), &bCol);

      :(

      Best Regards
      Leonard

      [quote author="SGaist" date="1395676216"]Hi and welcome to devnet,

      Isn't "winId":http://qt-project.org/doc/qt-5/qwindow.html#winId what you are looking for ? [/quote]

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Did you check that winId returns a valid value ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

          [quote author="SGaist" date="1395697547"]Did you check that winId returns a valid value ?[/quote]

          Yes I've checked, winId returns a not null value: 0x000605c0

          Best Regards
          Leonard

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Another thing that you can try is setting Qt::WA_NativeWindow on your widget before calling winId

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • L Offline
              L Offline
              leonimas
              wrote on last edited by
              #7

              Hi :(,
              does'nt works ... the code now is:

              QLabel* qLab = diag.findChild<QLabel*>("label");
              qLab->setAttribute(Qt::WA_NativeWindow);
              HWND h = (HWND)qLab->winId();
              Adesk::UInt32 bCol = RGB(255,0,255);
              b = acdbDisplayPreviewFromDwg(result->resval.rstring, h, &bCol);

              With MFC the working code is:

              acdbDisplayPreviewFromDwg(wstrFName, m_pStaticWnd->m_hWnd, &bCol)

              where 'm_pStaticWnd->m_hWnd' returns an HWND value, and m_pStaticWnd is a 'CWnd*' pointer to the ‘Text Control’ widget ...

              Why the QLabel widget doesn't show the bitmap ? Can be a painting
              refresh problem ?

              Best regards
              Leonard

              [quote author="SGaist" date="1395788591"]Another thing that you can try is setting Qt::WA_NativeWindow on your widget before calling winId[/quote]

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                That I can't say but it might be.

                By the way, why do you need to call acdbDisplayPreviewFromDwg ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  I just saw "this":http://qt-project.org/doc/qt-5/qwidget.html#effectiveWinId that might also be of some help

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    leonimas
                    wrote on last edited by
                    #10

                    I developing an autocad plugin (OBjectArx dll),
                    and I use the acdbDisplayPreviewFromDwg() function to display
                    a preview of a dwg file (little thumbnail)

                    There is a QT function to read dwg file ?

                    Thanks in advance

                    [quote author="SGaist" date="1395869296"]I just saw "this":http://qt-project.org/doc/qt-5/qwidget.html#effectiveWinId that might also be of some help[/quote]

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Not to read DWG file. However, if there's a DWG library than is usable somewhere there's always the option of writing a QImageIOPlugin using it.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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