[Qt-interest] QLabel buddy and Custom Widget.

NaGeL nagel182 at gmail.com
Mon May 2 18:33:10 CEST 2011


I did. And i said i looked at the headers files, and now too.

this is QLabel's  setbuddy function:

void QLabel::setBuddy(QWidget *buddy)
{
    Q_D(QLabel);
    d->buddy = buddy;
    if (d->isTextLabel) {
        if (d->shortcutId)
            releaseShortcut(d->shortcutId);
        d->shortcutId = 0;
        d->textDirty = true;
        if (buddy)
            d->updateShortcut(); // grab new shortcut
        d->updateLabel();
    }
}

what i understand from it is: its sets its buddy, and refreshes it
shourtcuts, the shortcut that will give focus to the widget.

but this is what I'm asking.... how can i redirect the focus of the shortcut
to  my Widget's QTextEdit?

I figured its Q_PROPERTY thing like it was with the mapping question I
had... setFocus, setFocusProxy.. doesn't really works...

2011/5/2 Bo Thorsen <bo at fioniasoftware.dk>

> Den 01-05-2011 18:01, NaGeL skrev:
>
>  Hello its the newb again.
>>
>> And now i would like to ask. How does QLAbel's buddy function works?
>> And how can I get it to work with my Custom Widget?
>>
>> My Widget Contains several tool button and a QTextEdit.
>> I want to set QLabel's buddy the QTextEit, that is inside my Custom
>> Widget.
>>
>> is this too a Q_Property stuff? if yes how? i looked into the  QLabel's
>> header and QTextEdits header files but i failed to find any indication...
>>
>
> I don't know this, but I know how I would find out: Read the Qt sourcecode.
> This is a perfect case of a problem that most likely will take you no longer
> than maximum 10 minutes to figure out by looking at the QLabel sources.
>
> I'm not trying to be clever here. This is a tool I use very often, and I
> think it's important to keep reminding people that it's available.
>
> Bo Thorsen,
> Fionia Software.
>
> --
>
> Expert Qt and C++ developer for hire
> Contact me if you need expert Qt help
> http://www.fioniasoftware.dk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110502/70d0e891/attachment.html 


More information about the Qt-interest-old mailing list