QDialogBox flickers - qt

I create a custom QDialogBox class and try to display it in the centre of my window using the 'move' command. However, I am facing an issue.
The dialog box appears at a random position on the screen and then moves to the position set by me after 1 second. This happens at random instances. I open the dialog box 10 times and I do not see this flickering. However, this happens the 11th time. There is no specific pattern. Is this a performance issue? This happens more frequently on slower machines.
If I run the dialog box as loginDialog->show(); the flickering is not there. However, it happens when I use: loginDialog->exec(). How can I resolve this issue?
CustomDialog *loginDialog = new CustomDialog( this );//a QDialogBox class
float width=350,height=180;
dialogBoxPosition(&width, &height);
_mFinalPoint.setX(width);
_mFinalPoint.setY(height);
loginDialog->move(_mFinalPoint);//moving it to a window center
loginDialog->loginWindow();//calling a member function
loginDialog->exec();

Related

Position jQuery Mobile popup allways 20 pixels below top position of visible area

I´m working on a tool only for tablets (Android, iPad) based on Cordova and jQuery Mobile (1.4.5). In the first phase of this tool, many of the users who have to work with it were asking for some more comfort regarding the behavior of the form popups.
The problem was:
As a user came to one section, I provided him with a collapsible-set, consisting of sub-sections. In this sub-sections, the user gets data-grids with Add, Edit and Delete buttons next to each data-set.
So, as the user tapped on Edit button (or Add), I opened up a popup with the necessary form and form-elements to edit this data-set or add new data to the database. But in many of the upcoming popups the amount of the form-elements is as high, so the popup appears higher or even much higher then the collapsible-set (including the data grid) behind the modal popup is.
The popup of jQuery Mobile is centered by default and even if I positionTo origin and pass x and y coordinates to it, the library/widget wants to position the popup to this coordinates by the center point, rather then the upper left corner.
Users always had to scroll around to come to the start point of the form and after submitting the form, they had to scroll up again to where they tapped on the button to open the popup.
Now I tried to do everything I could imagine, to force the popups top position to 20 pixels below the top position of the visible area on the tablet, regardless of where I am, when tapping on any Edit or Add button.
I was playing around with offset() (window.pageYOffset), etc. and set the position of the popup by:
popup2open.popup('open').css({'top':popupTopValue+'px','left':popupLeftValue+'px'});
In fact, the popup is positioned to exactly where I want it, if the top offset is between 0 and 100. On all values above 100, the top position of the popup increases by absolutely incomprehensible value. The only consistent fact is, that the more I scroll down before I tap on a button, the more this value increases - so it does not in/decrease by random.
(BTW: I found out that I have to set "popupLeftValue" to 0, so the popup is positioned in the center horizontally.)
I just can´t see any regularity on increasing value...
Can anybody give me a hint or a punch to the right direction?
Thank you in advance!
PS: I experimented also with .css({'position':'[fixed|absolute]','top':popupTopValue+'px','left':popupLeftValue+'px'}); and that worked well. Only to find out one show-stopper: If I set the focus to an input-field inside the form and than closing the virtual keyboard on the tablet, a reposition-event is triggered and by this, the popup is re-positioned massively below the former position (in fact around 300 pixels below and just marginalized to the right border of visual area). The Cancel and Save buttons are even out of scroll-able area.
(some more funny fact, btw.: if I set the focus to the same input-field, than not closing the virtual-keyboard but directly setting the focus to a select element and after this pressing the back button of the tablet to escape the select menu, no reposition-event is triggered...!?)
On 18th of July 2013 Gabriel Schulhof added this line to a feature-request from one user, who asked exactly for what I´m struggling around with:
"We are indeed considering adding such a feature..."

GTK# button drawn incorrectly?

My GTK# (v2.12.44) app has a single Window with a single button on it. The button appears to be centered on the Window, because that's where the text appears, but the border/background for the button is shifted up and to the left for no reason I can see. Has anyone seen this before? I saw similar behavior from an Image widget. Note this only happens in Windows, not on (for example) Raspberry Pi/Jesse.
Here's the code:
Application.Init();
var window = new Window("test") {new Button("testing 1, 2, 3")};
window.Maximize();
window.ShowAll();
Application.Run();
Your code works well. Try to add a container before adding a button and set some parametrs you want to. Fill and Expand when adding Button.

How do I find the part of a NSScrollView's documentView that's not beneath a window's toolbar?

I have a very simple setup. It's a single window with a toolbar, completely filled with a NSScrollView. The window is setup as follows:
window.styleMask = [.titled, .resizable, .closable, .fullSizeContentView]
window.titleVisibility = .hidden
This looks pretty gorgeous! However, I need to change how the content of the document view behaves as its frame changes. The problem is that docuentView.visibleRect reports that the minY is 0.0 until it hits the top of the window, not the bottom of the toolbar! So some of my custom drawing and behavior is cut off, and that is not so gorgeous.
How do I find the actually-usable rect of that document view, which excludes the part of it beneath the toolbar?
There is a property on the window called contentLayoutRect, which represents the portion of the window content that is visible (using non-flipped coordinates). You can use this to position the content view and rest assured that this will still work if Apple decides some other edge of the window becomes obscured.

Centering a QDialog relative to its parent while using RestoreGeometry()

I have a program that has several QDialogs. Most are a fixed size, but one is a resizable editor. The editor dialog gets its geometry restored from a QByteArray.
The problem I'm having is the Editor is not being centered correctly. (only the window's x/y dimensions) The Editor usually appears in the upper left corner when it is instantiated.
The Editor class gets instantiated like this in MainWindow:
Editor e(this);
e.exec();
For some reason, restoring the window geometry breaks the Editor's automatic centering relative to its parent. Before I implemented the SaveGeometry and RestoreGeomentry code today, the editor worked fine.
Here's the SaveGeometry code in Editor.cpp: (it gets executed right before the current Editor object is destroyed)
// Remember current window size
QByteArray geo=saveGeometry();
SettingsManager s;
s.SaveEditorSize(geo);
Here's the restore code in Editor.cpp: (this is part of a function that sets up the UI, assigns a layout, etc.)
if(!Buffer::editor_geometry.isEmpty()){
restoreGeometry(Buffer::editor_geometry);
}
Does anyone know what the problem is?
Edit: Actually, it does remember where it was last time, it just won't center.
Actually, I think I've solved this.
Instead of storing the entire window geometry, I tried storing just the size as a QSize. The size is then reapplied through QDialog::Resize() when the Editor is initialized. The window remembers its previous size and remains centered to parent like it is supposed to.

FLex 4.5 : strange scrolling behaviour in custom layout used in a list

I created a custom layout for a list, to be used on a mobile (android).
I used this as example : http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization, using virtualization.
Now the problem I have is with scrolling : when scrolling to the bottom of the list, there seems to be always a "bounce back", as if the list would have reached and as if the bounce/pull effect is taking place.
But in fact the list has not reached the end at all, in fact I can not even scroll to the last element in the list.
When going back from bottom to top, there's no problem at all.
I trace the top and bottom of the Scrolling Rectangle (Rectangle.getScrollRect) and there I can see that when scrolling down, the top and bottom parameters increase, but when releasing the touchscreen, all of a sudden the parameters decrease again with a certain amount, and so never reaching the end of the list.
All my code is available on google project hosting : http://code.google.com/p/helpdiabetes-air/source/browse/trunk/src/myComponents/TrackingViewLayout.as
solved. Double checked with the example given by Mihai Corlan
and actually I had left out one statement at the end of function measure :
layoutTarget.setContentSize(dataGroupTarget.width, totalHeight);
works fine now.

Resources