Tooltips to QML: PlasmaCore.Dialog questions

Mark markg85 at gmail.com
Sun Jun 17 20:46:10 UTC 2012


On Sun, Jun 17, 2012 at 8:41 PM, Mark <markg85 at gmail.com> wrote:
> On Mon, Jun 4, 2012 at 11:48 AM, Marco Martin <notmart at gmail.com> wrote:
>> On Monday 04 June 2012, Mark wrote:
>>> >
>>> > > is happening. The x position seems to be fine, the y position seems to
>>> > > be wrong.
>>> >
>>> > how are you positioning it? dialog.popupPosition? you should position it
>>> > before actually showing it
>>>
>>> Ehh, how do i use that one? I can't give a position with that function (it
>>> returns a position).
>>
>> it returns a position in function of an item on screen, it tries to position
>> the dialog above the desired item (in this case the widget owner of the
>> tooltip) already managing all the needed corner cases (when the parent item is
>> too near to a screen border so there isn't room to display the tooltip where
>> it should be)
>>
>> that function calculates a position, then you just assign x and y properties
>> of the dialog to that computed position
>>
>>> > > 3. The tooltip seems to have a minimal width + height of around 100
>>> >
>>> > pixels.
>>> >
>>> > > Where is that minimal limit set and how can i get rid of it?
>>> >
>>> > shouldn't have any, it should use whatever width/height the main item has
>>>
>>> It certainly has something.. I will recheck and come back to you about this
>>> one.
>>
>> only absolute minimum size it should have is the size of the background
>> borders
>>
>>
>> --
>> Marco Martin
>> _______________________________________________
>> Plasma-devel mailing list
>> Plasma-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/plasma-devel
>
> Hi,
>
> Proceeding with this one for fun.
> And i hit a little snag again. (not that i fixed the old ones..)
>
> This is for sending a pixmap to QML.
> The header side looks like this:
>    Q_PROPERTY(QPixmap icon READ icon)
>    const QPixmap& icon();
>
> The source side looks like this:
>    const QPixmap& ToolTip::icon()
>    {
>        return d->icon; // QPixmap
>    }
>
> Everything seems fine so far.
> Now if i call <myclass>.icon (the Q_PROPERTY) in a console.out i see:
>    QVariant(QPixmap)
>
> I'm fine with that, however,
>    QtExtraComponents.QPixmapItem
>    {
>        id: image
>        width: 48
>        height: 48
>        pixmap: ToolTipData.icon
>    }
>
> doesn't do that. The QPixmapItem only takes a QPixmap, not a QVariant.
> I remember patching QIconItem some time ago to accept a QVariant as
> input which is then being casted to a QPixmap if possible.
>
> So, the question here is. How do i send a QPixmap from QML to
> QPixmapItem? Or would you prefer it if i patch QPixmapItem (and
> QImageItem for completeness) to accept a QVariant?
> I'm also wondering how this is currently working anywhere since QML
> sends a QVariant(QPixmap), not a direct QPixmap. Or am i touching code
> now that nobody actually uses - besides me...
>
> Cheers,
> Mark

A little bit of extra information.
I debugged the image data a bit. It turns out that the image data is
just fine on the C++ side where it's being made available to QML.
Then, when it gets send back to C++ with QPixmapItem the image data
seems to be just empty! I have no clue why that happens.


More information about the Plasma-devel mailing list