zahra
کاربـــر عـــــادی-
تعداد ارسال ها
8 -
تاریخ عضویت
-
روز های برد
1
آخرین بار برد zahra در 28 آذر 1399
zahra یکی از رکورد داران بیشترین تعداد پسند مطالب است !
اعتبار در سایت
1 خوبدرباره zahra
توسعه دهنده بَک اِند
توسعه دهنده فرانت اِند
طراحان
کاربـــر عـــــادی
توسعه دهنده فرانت اِند
طراحان
کاربـــر عـــــادی
- تاریخ تولد تعیین نشده
-
سلام چطوری می تونم اپلیکیشنی که با qt طراحی کردم رو روی GPU اجرا کنم ؟ آیا این امکان وجود داره که بخش دریافت داده ها از شبکه و پردازش اونها توسط CPU انجام بشه و بخش گرافیکی اون رو از طریق GPU اجرا کنم ؟ آیا qt این ویژگی رو پشتیبانی می کنه؟ ممنون
-
سلام با تعریف یک property در بدنه repeater به صورت زیر مشکل حل شد : Repeater { id: repeater model: 5 Rectangle { color : "transparent" id : myRectRepeater property int radius: 15 gradient: mygradient width: radius property var myColor: Global.Theme? "red" : "blue" Button { id:control x: 20 y : -25 Text { id : saveId// saveId text: qsTr(Global.textArray[index]) font : myFont color: myColor anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter } } onClicked: { } } } } for(var idx1 =0; idx1 < 5; idx1++) { repeater.itemAt(idx1).myColor = Global.fontColor_gray ; repeater.itemAt(idx1).mygradient = myTheme }
-
سلام دسترسی به اعضای nested یک repeater به چه صورتی هست؟ من با استفاده از دستور زیر به جواب نرسیدم : repeater.itemAt(id).children[0].children[0].children[0].color = "red"; Repeater { id: repeater model: 5 Rectangle { property int radius: 15 gradient: Global.Theme width: radius Button { id:control x: 20 y : -25 Text { id : saveId// saveId text: qsTr(Global.textArray[index]) font : myFont color: Global.Theme ? Global.fontColor_gray : "red" anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter } InnerShadow { //anchors.fill: parent cached: true visible: true horizontalOffset: 0 verticalOffset: 0 radius: 8 samples: 16 color: Global.Theme ? Global.innerShadowColor_gray : "red" smooth: true source: saveId } DropShadow { anchors.fill: saveId source: saveId verticalOffset: 4 //color: "#80000000" color: Global.Theme ? Global.dropShadowColor_gray : "red" radius: 30 samples: 300 } background: Rectangle { implicitWidth: 130 implicitHeight: 55 border.width: control.activeFocus ? 2 : 1 border.color: "darkgray" radius: 10 gradient: Global.Theme ? gradientProvider.gradientThem_1 : gradientThem_0 } onClicked: { } } } }
-
سلام من برای اینکه یک آرایه از داده ها رو در qml نمایش بدم از ChartView و LineSeries استفاده می کنم و دستور append رو برای LineSeries در تایمر فراخوانی می کنم. میخوام وقتی یک بار عرض صفحه پیمایش شد، برای اینکه real time بودن گراف نشون داده بشه، یک eraser تعریف کنم که هر بار چند پیکسل از داده های جلوی خط رو حذف کنه و گراف رو بروز رسانی کنه. با تعریف دو LineSeries به نتیجه دلخواه نمی رسم ، میخواستم بپرسم کسی تجربه این در این زمینه داره که به اشتراک بگذاره؟ Rectangle { id: myRect width: 600 height: 400 anchors.centerIn: parent LinearGradient { anchors.fill: parent } ChartView { id: chartView anchors.centerIn: parent width: 600 height: 400 backgroundColor: "transparent" title: "My Graph" titleColor: Qt.rgba(.5,.5,.5,1) titleFont.pointSize:10 anchors.fill: parent antialiasing: true anchors { fill: parent; margins: 5 } margins { right: 0; bottom: 0; left: 0; top: 0 } Component.onCompleted: { axisX(lineSeries).visible = false axisY(lineSeries).visible = false } Rectangle { id: rec height:parent.height x: 30 y: 50 width: 1 color: "red";// "transparent" } ValueAxis { id: axisX min: 0 max: 100 color: "transparent" labelsFont:Qt.font({pointSize: 10}) } ValueAxis { id: axisY min: -300 max: 300 color: "transparent" } LineSeries { id: series1 axisX: axisX axisY: axisY name: "From QML" useOpenGL: chartView.openGL color: "#44D77B" width: 1 pointLabelsColor: "red" } LineSeries { id: series2 axisX: axisX axisY: axisY name: "From QML" useOpenGL: chartView.openGL color: "#44D77B" width: 1 pointLabelsColor: "red" } } } Timer { interval: 50 repeat: true running: true onTriggered: { series1.append( timeStep , myArray[index]); if(index == 400) { index =0; series1.clear(); //series2.clear(); timeStep=0; first = true; timeStep1 = 5; index1 = 5; } //updateRectangle(); print("index : " , index); timeStep+= 1;// 0.25; index++; } } ممنون
-
سلام من یک برنامه به شکل زیر ساختم : #ifndef MYCLASS_H #define MYCLASS_H #include <QtCore/QObject> class MyClass : public QObject { Q_OBJECT Q_PROPERTY(QByteArray arr READ getarr WRITE setarr NOTIFY ValueOnChanged) public: explicit MyClass QObject *parent = nullptr); ~MyClass(); const QByteArray & getarr() const { return m_arr; } void setarr(const QByteArray & v) { if (m_arr != NULL) { //m_arr = v; m_arr.resize(5); m_arr[0] = 0x3c; m_arr[1] = 0xb8; m_arr[2] = 0x64; m_arr[3] = 0x18; m_arr[4] = 0xca; emit ValueOnChanged(); } } signals: void ValueOnChanged(); private: QByteArray m_arr; }; #endif // MYCLASS_H و بعد تابع main.cpp رو به صورت زیر تغییر دادم : #include <QGuiApplication> #include <QQmlApplicationEngine> #include "MyClass.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); //registering QML type here qmlRegisterType<MyClass>("com.org.myclass", 1, 0, "myclass"); engine.load(url); return app.exec(); return app.exec(); } و حالا در qml به این صورت به داده ها دسترسی دارم : import QtQuick 2.9 import QtQuick.Window 2.3 import QtQuick.Controls 2.2 import com.org.myclass1.0 Window { visible: true width: 640 height: 480 title: qsTr("qt-qml-module-example") MyClass{ id: myClass } property variant varList Component.onCompleted : varList=myClass.arr onVarListChanged: { print("len : " , myClass.arr.length) for (var i in varList){ console.log(i) print("----") } } } در خروجی که میخوام مقادیر QByteArray رو بخونم ، پیغام undefined نشون میده .برای یک متغییر bool درست کار می کنه ولی برای آرایه که بعدا میخوام مقادیر فایل رو در اون لود کنم، خطا میده. ممنون میشم اگر تجربه ای دارید راهنمایی کنید.
-
ممنون از پاسختون من تازه کار با qt رو شروع کردم . الان یک فایل باینری رو با استفاده از دستورات QByteArray و QFile در qt می خونم و به مقادیرش دسترسی دارم. حالا می خوام با استفاده از روشهای موجود این داده ها رو به qml ارسال کنم . و در مرحله بعدی این داده ها رو نمایش بدم. QFile file("E:/Test.bin"); qDebug() << ".... Here "; if (file.open(QIODevice::ReadOnly)) { QByteArray blob = file.readAll(); qint64 len = blob.length(); qDebug() << ".... Here " << len; for(int i =0; i< len; i++) qDebug() << "value : " << blob.at(i) << " ---- "; } qDebug() << "Results : " << endl; ساده ترین کار برای ارسال داده های QByteArray به qml چه روشی هست؟ آیا نمونه کدی هست که من بتونم ازش ایده بگیرم؟ ممنون
-
سلام چطوری می تونم یک فایل باینری رو در qt بخونم و داده هاش رو به صورت یک آرایه در qml نمایش بدم؟ ممنون