Results 1 to 8 of 8

Thread: Plugin & Designer

  1. #1
    Join Date
    Jul 2006
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Plugin & Designer

    Hello,

    I have a QLabel and QLineEdit that forms part of plugin for a designer. When I use it in a Dialog I don't see the key cursor blink of QLineEdit, here's my code:

    akLabelName = new AKLabel(); //inherits from QLabel
    akFieldEdit = new AKField(); //inherits from QLineEdit

    setFocusPolicy(Qt::StrongFocus);
    //akFieldEdit->setFocus();
    akFieldEdit->installEventFilter( this );
    akFieldEdit->setFocusPolicy( Qt::StrongFocus );
    setFocusProxy(akFieldEdit);

    QHBoxLayout *qHBoxLayout = new QHBoxLayout();
    qHBoxLayout->addWidget(akLabelName);
    qHBoxLayout->addWidget(akFieldEdit);

    QVBoxLayout *qVBoxLayout = new QVBoxLayout();
    qVBoxLayout->addLayout(qHBoxLayout);
    setLayout(qVBoxLayout);

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    What does eventFilter in your dialog?
    I assume that you implemented it since you install the dialog as event filter for the line edit.

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    You create those object without a parent. That is the problem.
    Add "this" as parent for the label and line edit.

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    Therefore, the dialog will not forward any focus events to your widgets.

  5. #5
    Join Date
    Jul 2006
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    I don't understand you, if I use the Qt Designer and I create a new dialog and I put my plugin and I make a preview when the QlineEdit plugin receives the focus the key cursor don't blink. In Qt Designer there's a similiar plugin in the scratchpad "frame" that is similar to my plugin and his key cursor blink.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Plugin & Designer

    Quote Originally Posted by marcel View Post
    You create those object without a parent. That is the problem.
    Add "this" as parent for the label and line edit.
    No. Adding widgets to a layout reparents them.

    Quote Originally Posted by fpujol View Post
    I don't understand you, if I use the Qt Designer and I create a new dialog and I put my plugin and I make a preview when the QlineEdit plugin receives the focus the key cursor don't blink. In Qt Designer there's a similiar plugin in the scratchpad "frame" that is similar to my plugin and his key cursor blink.
    Marcel asked you for the event filter. Could we see its code?

  7. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    No. Adding widgets to a layout reparents them.
    Yes, you're right( from QWidget::setLayout ):
    Qt Code:
    1. if (l->parent() != this) {
    2. l->setParent(this);
    3. l->d_func()->reparentChildWidgets(this);
    4. l->invalidate();
    To copy to clipboard, switch view to plain text mode 
    But the layout won't be set if the dialog already has a layout.
    This could be the problem. Or the eventFilter.

  8. #8
    Join Date
    Jul 2006
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Plugin & Designer

    oohhh excuse me my friends I found the problem. I found this methods that some day I use to do a test and then I don't remembered to quit it.

    void focusInEvent ( QFocusEvent * event );
    void focusOutEvent ( QFocusEvent * event );

    Thanks a lot, now I see the key cursor to blink is so nice.

Similar Threads

  1. Replies: 1
    Last Post: 22nd January 2007, 12:13
  2. Replies: 13
    Last Post: 15th December 2006, 11:52
  3. Replies: 5
    Last Post: 23rd May 2006, 11:40
  4. Size of a plugin widget in designer
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2006, 13:29
  5. Managing widget plugin in Qt Designer
    By yellowmat in forum Newbie
    Replies: 8
    Last Post: 31st January 2006, 09:58

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.