Results 1 to 3 of 3

Thread: Where's QWinHost include ?

  1. #1
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Where's QWinHost include ?

    I'm trying to use it, but, <QWinHost> <qwinhost.h> can't be found, how i can include it ?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Where's QWinHost include ?

    That is not part of the Qt framework, it's from Qt solutions, source can be found here.
    Last edited by Zlatomir; 21st April 2011 at 22:35. Reason: spellcheck ;)

  3. #3
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Where's QWinHost include ?

    Thanks ^^, I'm using it, but now, with another problem.

    Qt Code:
    1. QWidget* HotKeyDelegate::createEditor(
    2. QWidget* parent,
    3. const QStyleOptionViewItem& option,
    4. const QModelIndex& index) const
    5. {
    6. QWidget* w = new QWidget(parent);
    7. QGridLayout* qgl = new QGridLayout(w);
    8. qgl->setMargin(0);
    9. HotKeyEditor* e = new HotKeyEditor(w);
    10. qgl->addWidget(e);
    11. return w;
    12. }
    To copy to clipboard, switch view to plain text mode 

    And, the hotkey command finally loaded, but, it's messages isn't responding
    I can press any key, or click, and it's only lose focus and the TableWidget stops the editing of the cell.

    Why this is happening ?

    The class code:

    Qt Code:
    1. class HotKeyEditor : public QWinHost
    2. {
    3. Q_OBJECT
    4. public:
    5. explicit HotKeyEditor(QWidget *parent = 0);
    6. virtual ~HotKeyEditor();
    7.  
    8. protected:
    9. virtual HWND createWindow(HWND parent, HINSTANCE instance);
    10. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. HotKeyEditor::HotKeyEditor(QWidget *parent) :
    2. QWinHost(parent)
    3. {
    4. this->resize(100, 20);
    5. }
    6.  
    7. HotKeyEditor::~HotKeyEditor()
    8. {
    9. }
    10.  
    11. HWND HotKeyEditor::createWindow(HWND parent, HINSTANCE instance)
    12. {
    13. HWND wnd = CreateWindowExA(0, HOTKEY_CLASSA, "", WS_CHILD | WS_VISIBLE, 0, 0,
    14. 0, 0, parent, 0, instance, 0);
    15.  
    16. HFONT font = CreateFontA(14, 0, 0, 0,
    17. FW_DONTCARE,
    18. FALSE, FALSE, FALSE,
    19. DEFAULT_CHARSET,
    20. OUT_OUTLINE_PRECIS,
    21. CLIP_DEFAULT_PRECIS,
    22. CLEARTYPE_QUALITY,
    23. VARIABLE_PITCH,
    24. 0);
    25.  
    26. SendMessageA(wnd, WM_SETFONT, (WPARAM)font, 0);
    27. SendMessageA(wnd, WM_SETFOCUS, 0, 0);
    28.  
    29. return wnd;
    30. }
    To copy to clipboard, switch view to plain text mode 

    EDIT:
    The code works if the host is outside the delegate in TableWidget, but, i need it for editing the cell
    Last edited by rsilva; 21st April 2011 at 23:54.

Similar Threads

  1. Replies: 0
    Last Post: 18th April 2011, 17:11
  2. Replies: 1
    Last Post: 3rd March 2011, 19:17
  3. How to include a dll ???
    By anupamgee in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2010, 08:28
  4. mfc in QT include
    By trusch in forum Qt Programming
    Replies: 3
    Last Post: 16th July 2009, 10:01
  5. include
    By mickey in forum Newbie
    Replies: 6
    Last Post: 4th April 2006, 23:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.