Solved ApplicationWindow "opacity" is error?
-
import QtQuick.Controls 2.0
ApplicationWindow
{
opacity : 0.8
}
error:
applicationwindow.opacity is not available due to component version -
Hi Alex_wang,
I don't know what version of Qt you are using. In Qt5.9 you can use :
import QtQuick 2.7
If I omit hits import directive I can reproduce your problem.
Eddy
-
Qt version : 5.8.0
import QtQuick 2.5 -
Can you check the highest import versions available on your system. AFAIR it could be for Qt5.8:
import QtQuick 2.7 import QtQuick.Controls 2.1
-
Hi,
My attention was needed in the real world. Now I'm back, but unfortunately I cannot reproduce the use case where I didn't have any problems.
I found some similar bugs reports with the same error message but yours looks differently.
You could file a bug report for your case, unless somebody else knows a solution here.
-
Hi.
It's not a bug.
It's releated to meta object revison.
Property oapacity of ApplicationWindow is defined as revison 1.
But, QtQuick.Controls 2 can only use revision 0.
Take a look at the defined type information for that plugin(aka. plugins.qmltypes) and following doc: http://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#type-revisions-and-versions -
Hi, it is a bug and has been fixed in Qt 5.9.1.
-
As a workaround, you could try setting the opacity in Component.onCompleted or using Binding element.
-
@jpnurmi
Thanks for the feedback.@Alex_wang : you can use it like this:
import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 ApplicationWindow { id: app visible: true width: 640 height: 480 title: qsTr("Hello World") color: "yellow" Binding { target: app; property: "opacity"; value: 0.5}
-
thanks all replies!
Thanks for Eddy and jpnurmi !