qt5.6

How qml call static method from c++

孤街浪徒 提交于 2021-01-19 22:49:44
问题 What I done: validator.h: class UTILSSHARED_EXPORT Validator: public QObject { Q_OBJECT public: Validator(QObject *parent = 0); ~Validator(); Q_INVOKABLE static bool validateMobile(const QString target); }; main.cpp: qmlRegisterUncreatableType<Validator>("CT.Utils", 1, 0, "ValidatorKit", "It just a kit"); qml: import CT.Utils 1.0 ValidatorKit.validateMobile("112344") But unfortunately, I got an error that said: TypeError: Property 'validateMobile' of object [object Object] is not a function

How qml call static method from c++

烂漫一生 提交于 2021-01-19 22:47:55
问题 What I done: validator.h: class UTILSSHARED_EXPORT Validator: public QObject { Q_OBJECT public: Validator(QObject *parent = 0); ~Validator(); Q_INVOKABLE static bool validateMobile(const QString target); }; main.cpp: qmlRegisterUncreatableType<Validator>("CT.Utils", 1, 0, "ValidatorKit", "It just a kit"); qml: import CT.Utils 1.0 ValidatorKit.validateMobile("112344") But unfortunately, I got an error that said: TypeError: Property 'validateMobile' of object [object Object] is not a function

How qml call static method from c++

荒凉一梦 提交于 2021-01-19 22:46:20
问题 What I done: validator.h: class UTILSSHARED_EXPORT Validator: public QObject { Q_OBJECT public: Validator(QObject *parent = 0); ~Validator(); Q_INVOKABLE static bool validateMobile(const QString target); }; main.cpp: qmlRegisterUncreatableType<Validator>("CT.Utils", 1, 0, "ValidatorKit", "It just a kit"); qml: import CT.Utils 1.0 ValidatorKit.validateMobile("112344") But unfortunately, I got an error that said: TypeError: Property 'validateMobile' of object [object Object] is not a function

How to make svg icons crisp again in Qt 5.6 on high DPI screens

会有一股神秘感。 提交于 2020-07-18 07:42:26
问题 Upgrading from Qt 5.4 to Qt 5.6 made all my .svg icons blurry/pixelated. I noticed this happens only on high density screens like on my MacBookPro Retina Display. I read the documentation of High DPI support in Qt 5.6 and I have set the QT_AUTO_SCREEN_SCALE_FACTOR=1 environment variable, but it didn't have much effect. Anybody has this issue? I have also found this bug report which probably relates to my question. EDIT 1: A simple example would be: Image { source: my_icon.svg sourceSize.width

Can I set QT_AUTO_SCREEN_SCALE_FACTOR behavior via API?

核能气质少年 提交于 2020-01-11 10:41:31
问题 Can I set the QT_AUTO_SCREEN_SCALE_FACTOR 1 behavior via an API call rather than by the environment variable? I want to detect if my Qt application is running on a high dpi screen, then set the scaling accordingly. I have tried to set it at the very beginning of main , which does not work QProcessEnvironment::systemEnvironment().insert("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); It's meant to be used along with QProcess, to set the environment for child processes. It cannot be used to change the

How to direct keyboard input QOpenGLWindow in 5.6

杀马特。学长 韩版系。学妹 提交于 2020-01-07 02:03:01
问题 I converted my Qt application from Qt 5.3 to 5.6. Previously I used to use QGLWidget and now upgraded to QOpenGLWindow contained in a QWidget. I would like my window to handle some key press events. QOpenGLWindow does have protected methods to handle the keyboard events. However, as opposed to the old QGLWidget, it does not have setFocus() method and my handlers are not being called. What is the remedy? Even when I tried to resort to setting focus to the owning container then manually piping

How to direct keyboard input QOpenGLWindow in 5.6

风格不统一 提交于 2020-01-07 02:02:37
问题 I converted my Qt application from Qt 5.3 to 5.6. Previously I used to use QGLWidget and now upgraded to QOpenGLWindow contained in a QWidget. I would like my window to handle some key press events. QOpenGLWindow does have protected methods to handle the keyboard events. However, as opposed to the old QGLWidget, it does not have setFocus() method and my handlers are not being called. What is the remedy? Even when I tried to resort to setting focus to the owning container then manually piping

Cannot load pepper flash plugin in QtWebEngine with Qt5.6

邮差的信 提交于 2020-01-02 07:25:24
问题 I made a simple web browser but when I access to https://get.adobe.com/jp/flashplayer/ It says Adobe Flash Player is already installed, but disabled However as I read http://doc.qt.io/qt-5/qtwebengine-platform-notes.html It says that pepper flash plugin should be automatically loaded if there is a proper dll file. I checked my C:\Windows\System32\Macromed\Flash\ and I'm sure that I have a pepflashplayer32_21_0_0_213.dll there. Then I also set QWebEngineSettings *websetting =

Enable own widget for stylesheet

霸气de小男生 提交于 2019-12-25 01:15:36
问题 I want to enable my own widget class for stylesheets, whereat I am not talking about setStyleSheet(qss) , but selectors in a qss stylesheet. It is understood that I have to replace the "::" with "--" in namespaces. Here ( Qt Stylesheet for custom widget ) I have found a similar question, but it is > 4 years old. Based on the answer I have some detailed questions: a) Is the published approach with an overridden paintEvent still valid (Qt5.6/5.7), from https://stackoverflow.com/a/8817908/356726

Zoom feature for QWebEngine does not work

醉酒当歌 提交于 2019-12-24 00:48:05
问题 I created simple project for displaying local .html page. I used Qt5.4 with QWebView there. But after switching to Qt5.6 I noticed that Qt WebKit is deprecated and not supported any more. Thus I decided to replace Qt WebKit functionality with one from the Qt WebEngine. After replacing QWebView with QWebEngineView I investigated that setZoomFactor method has no effect. Is it known issue? How can I handle with this? EDIT: An interesting thing have been investigated recently. I use setHtml