Tooltips to QML: PlasmaCore.Dialog questions
Mark
markg85 at gmail.com
Sun Jun 17 23:30:38 UTC 2012
On Sun, Jun 17, 2012 at 10:52 PM, Mark <markg85 at gmail.com> wrote:
> On Sun, Jun 17, 2012 at 10:46 PM, Mark <markg85 at gmail.com> wrote:
>> 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.
>
> GRRR, got it working.
> I thought a Q_PROPERTY could work just fine without NOTIFY..
> apparently that's not the case. Added the NOTIFY and it works now.
There we go again. First of all, it's working somewhat with the
taskbar tooltips. No windows previews, but that is something
completely different. I did however got a massive irritation against
the current dialog implementation.
Here is what's wrong with it.
1. I "need" to use the popupPosition function. But for which purpose?
I can perfectly align my tooltip using X and Y based on the component.
Actually, my earlier issue of having a default 100x100 sized dialog is
because i wasn't using popupPosition! Yeah, go figure that one out. I
just don't like the fact that i need to use that function. What i am
doing right now is calling popupPosition (because it has to be done)
then just use my own X and Y since the popupPosition isn't even
working as i want it. So yeah, i'm really doing
dialog.popupPosition(null, Qt.AlignCenter) because i have to..
2. This is a very important one which is not possible in the current
dialog. When you hover your taskbar to some element that has a bigger
tooltip (like the network manager icon) i want the tooltip to resize
in an animated way. That's not possible because width and height are
read-only!
3. The margin stuff that's done somewhere in the dialog C++ side is
not always working correctly when you animate the dialog. For
instance, my dialog is the right size, but when animation it kinda
"jumps" just when the animation is done thus screwing the layout!
4. The way that i need to set a "main item" inside the
PlasmaCore.Dialog looks really really really ugly!
So here we are again. I'm still working on the same issue and the darn
popup dialog thing with it's custom security measures to prevent full
screen stuff is really irritating me! So i would like to ask - again!
- to allow me to implement the Window in QML just like it is in Qt
Desktop Components and add it to probably QtExtraComponents. Right now
these dialog issues are blocking me to continue since it's not that
obvious when i hit another snag if it's in the dialog (again) or in my
code.
I understand that you guys (marco only?) want to prevent abusive
applications popping up that make fullscreen plasmoids, but that
argument is really faulty. I already made a fullscreen dialog just to
see if it's possible. Obviously it is and it's easy once you know how
to. You can make it as hard as possible like it is now, but that is
really making it limited (and ugly) for other real world usages like
these tooltips.
Lastly, i noticed there is a PlasmaCore.Dialog and a
PlasmaComponents.Dialog ... Does anyone know what the difference is
and why there are 2 of them? I also added
http://techbase.kde.org/Development/Tutorials/Plasma/QML/API#QtExtraComponents
since there was no documentation for it yet (that i know of). Some
improvements from the authors would be welcome.
Cheers,
Mark
More information about the Plasma-devel
mailing list