Qt Installer Framework : Hide the Back button - qt

How to Hide the Back Button in Qt installer framework?
Please see attached image.

See my answer to Qt installer framework hide or disable buttons quoted below:
For the wizard BackButton specifically, it automatically disables itself if there are no pages before the current page a la the Introduction page.
From QtScript this can be accomplished by removing any dynamic pages before the current page with installer.removeWizardPage and disabling all default pages before the current page with installer.setDefaultPageVisible(QInstaller.Introduction, false).

There is void QWizard::setButton ( WizardButton which, QAbstractButton * button ) what means you schould be able to set a button which behaves like you need it. Derive a Class from QAbstractButton. Reimplement the paintEvent() to paint nothing and reimplement the mouseEvents to do nothing. That should do the (dirty) trick. Even if the wizard sets it to be visible, it won't draw itself and can't digest and mouse actions. Just tested it ... should work for you.

Related

How to hide a widget created by QtDesigner "design" mode programmatically?

I want to know how to create a QLabel in QtCreator Design mode that is hidden by default?In the properties list in the right hand side panel , there's not any option regarding visibility and also adding label->hide() to setupUi function (after compiling ui file and adding to the project headers) makes no difference.
Designer doesn't expose the visible property. You could hand-edit the UI file, but that will be overwritten next time you edit in Designer. It's best to leave it visible in Designer, and just write a line of code after you call setupUi() to hide the widget you don't want to be initially shown.

How to prevent QWebEngineView to grab focus on setHtml(...) and load(...) calls?

I have created simple Qt Window Layout with QTreeView and QWebEngineView: after selecting some item in the tree view, the Web engine view shows some content. The problem is what when QWebEngineView::setHtml(...) or load(...) is called the tree view loses keyboard focus and Web engine view gets it. This causes difficulties when selecting items with keyboard in the tree view. So, how to prevent the tree view focus lost?
I tried to use QTextBrowser instead of QWebEngineView. It doesn't have this problem, but it is not suitable for complex HTML pages.
Suppose we have:
QWebEngineView *webView = new QWebEngineView;
For Qt 5.8 and newer
The problem can be solved by tweaking settings:
webView->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
The sample code: https://github.com/rmisev/FocusWidget/tree/if-qt-5.8
References:
QWebEngineView::settings()
QWebEngineSettings Class
QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)
QTBUG-52999
For Qt 5.7 and earlier
The simplest solution (also pointed by #Netrix) is to call:
webView->setEnabled(false);
But this disables keyboard input to the webView.
To solve this problem I created the simple FocusWidget class as parent widget for webView, which works as follows:
Initially it disables webView (webView->setEnabled(false)), so prevents to take focus on load(...), setHtml(...) calls.
When FocusWidget gets focus, it enables and forwards focus to webView, so enables keyboard input.
When webView and its children loses focus, FocusWidget disables webView again
The source code and sample application: https://github.com/rmisev/FocusWidget
I encountered the same problem in my app in PyQt5. What I managed to do is to disable the whole widget like this (in Python):
view = PyQt5.QtWebEngineWidgets.QWebEngineView()
view.setEnabled(False)
This resulted in view being operational with mouse (it accepts mouse clicks and things can be changed on web page) but i won't take focus from different widget.
I would definitely call it a bug instead of feature in QtWebEngineWidgets.
Thanks to all the others who provided answers for this. After encountering this bug I was somewhat stumped, but after learning of the way setEnabled(false) affects the focus stealing from the other answers I discovered that simply disabling the webview, setting the html or reloading it, then re-enabling it circumvents the issue (at least in Qt 5.7):
I.E.
myWebView->setEnabled( false );
myWebView->setHtml( html );
myWebView->setEnabled( true );
or
myWebView->setEnabled( false );
myWebView->reload();
myWebView->setEnabled( true );
This allows you to fix the problem without needing to subclass anything as one of the other answers suggests.

Qt creator - make a dynamic interface

I am working on a small UI with QT Creator and its drag-n'-drop tool (QT Designer). Everything was fine till I realized I had to make some widgets dynamic. For example, I have a checkbox and I want some button to appear only if this checkbox is checked by the user or I would like to change the appearance of another widget when the user clicks on some button.
Is it possible to do it only with QT Designer?
Yes, but it's very limited.
Qt designer have signal&slot editor. Yes, you can connect signal clicked(bool) to setVisible(bool) slot on button and make button visible only when checkbox is checked (see screenshot).
But when You need more complex dynamic interface (e.g. creating buttons), designed will not help You.

how to se t the right click operations of a link in qtwebkit

How to edit QtWebKit's right-click context menu in Qt Creator?
how to get response in QtWebKit
https://qt-project.org/forums/viewthread/15149/
i have seen all these threads and more but cant get my anwser
i want to set the righ click menu of links images frames etc. in qtwebkit
in qwebview
i have heard that we have to install an event filter and get the object which is at that position but i am not geting it
can you tell me a simple and sweet solution
tell how to set the operation of that action
also iut would be great if you can give a sample live working code
i have heard that we have to use QMenu and QAction for this.
To get a "standard" menu from QWebView based upon where you clicked, do:
page()->updatePositionDependentActions(pos);
QMenu* ctxMenu = page()->createStandardContextMenu();
to know on what you clicked, use
QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint());

Qt can I drag and drop from widget to Qwebkit?

I'm developing simple HTML editor and I like to be able to drag and drop from a button that for example represent HTML text line and in the Qwebkit the HTML text line will be created does Qt support such action?
How should I approach such thing?
I believe it does, yes.
What you need to do is set the mime type of your drag event. See here for details. Then on the webkit side, you can read the drops mime type to see what it was.
You can then try one of the following approaches:
Subclassing QWebView to implement dragEnterEvent and dropEvent. You can use event->pos() in the dropEvent to get the position where the drop occured.
Implementing the drop in javascript within your page, eg setting up an event listener for drops or however its done (I've never tried this).

Resources