跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • Using BLFS and Arch Linux Have Error qt.qpa.xcb: could not connect to display

    Unsolved
    9
    0 評價
    9 貼文
    2k 瀏覽
    G
    Yes I logout and in the LXDM I choose "Plasma (X11)" then it hangs but the cursor of the mouse changing shape.
  • QSqlRelationalTableModel Example to Qml (TableView) with relation

    Solved
    2
    0 評價
    2 貼文
    949 瀏覽
    freaksddF
    I found a solution by my self. My solution ... : show in the relation field only a ComboBox (in future i will have a Lable to change the label by click to ComoBox) can read and write the value of the current filed So...at first i find out, that i used in the example above the Quick.Controls 1 .. so the old one. Now i update my Code to Quick.Controls 2. The only misstake i found is, i haven't read the api to the end. Why was the resulting Column empty? When you use realtions and one of the columnName of both tables are equal (in this example like 'name'), the filedName will change in the form of (e.g. tablename_columnname_id) QSqlRelationTableModel - Found under 'Detail Description' under 'Notes' When you debug the currentFieldNames u find the right name. In the example above the value use: city_name_3 When you use a read-only Component like Label, it looks like: Label { text: city_name_3 } When you want to use a read-write value in a comboBox, i found only the solution to write my one invokable funtion to get the relation-data: (this code is only for Test to get and write the Data .. it is not optimiesd for now) QSqlRealtionTableModel: [HEADER] ... Q_INVOKABLE QVariant getRelation(const QModelIndex &item, int role = Qt::EditRole); ... [CPP] QVariant LQSqlRelationalTableModel::getRelation(const QModelIndex &item, int role) { if (item.row() >= rowCount()) return QString(); QSqlRelation rela = relation(role); // is any realtion on this role? if(!rela.isValid()) return QString(); // get the table of the realtion QSqlTableModel *rModel = relationModel(role); QVariantList list; for(int i = 0; i < rModel->columnCount(); i++) { // look for the write headerName we need if(rModel->headerData(i, Qt::Orientation::Horizontal) == rela.displayColumn()) { for(int j = 0; j < rModel->rowCount(); j++) { // use the data-method for QSqlTableModel to get all values from the RealtionCoumn and save it in a List QModelIndex modelIndex = rModel->index(j, i); QVariant value = rModel->data(modelIndex); list.append(value); } break; } } return list; } When you use now this data for a model, you got a list of all the poibile relation-data: [QML] TableView{ model: relaModel delegate: DelegateChooser { // Qt.Quick.Controls 2 DelegateChoice { column: 0 delegate: Label { // it is also possible to use as spinbox, but by id you do not need realy text: id } } DelegateChoice { column: 1 delegate: Label { text: name } } DelegateChoice { column: 2 delegate: ComboBox { implicitWidth: 140 onActivated: { relaModel.setData(relaModel.index(row, column), currentText) } Component.onCompleted: { model = relaModel.getRelation(relaModel.index(row, column)) currentIndex = relaModel.hasRelation(relaModel.index(row, column), city_name_3) } } } DelegateChoice { column: 3 delegate: TextField { text: country_name_2 selectByMouse: true implicitWidth: 140 onAccepted: { // i don't know why the get a different row like '-1' - so i have to check it if (row >= 0) { var sendText = text relaModel.setData(relaModel.index(row, column), text) } } } } } } so know it comes the importend thing: in the comboBox the come the hole Data from the relationTable, so there text is the expected one. in the TextField of Column 3 (Country) can you write the text by hand. But the Text have to be exactly one of the realtionData's-ID. So you do not have the ID -> you have the value, the Data will not write in the Database. -> you will handle this in ::setData(...) Why does the cpp look so difficult and to much for some little thing? currently i found this solution cause you got only the realtion-data but you have to set the right id 5000 . Example: for the first Row you got for Espen the city-id: 5000 -> this is the realtion to city-name Oslo The Problem is, that you get in the ::data-function the realtion-Data ('Oslo') and not the id ('5000') When you wnat to set the data, you have to compare, if the data in the City-Table in Column Name. So you only handle the data with the realtion and not with the id. -> that make it immpossible, that you use unique-values in the column name of the table city Why? When you have two values with same name, the data will fetch only the first one. so it is possible that you got the wrong data So now my test looks like: [image: a3bb8cbd-a33f-44fa-8c63-b8ae890d5ac1.jpg] +++++++++++++++++++++++++ The next questions is, how to get the id (5000) instead of the realtion-Data (Oslo ) to handle columns with no unique-values. Any Idea? +++++++++++++++++++++++++ I know i use in this example a SpinBox for Id, but it is only a test to handle some Components with this QSqlRealtionTableModel. I'm realy sorry for my english, but i hope you understand all what i want to tell you. Greetings from Germany
  • Customizing PathView animation

    Unsolved
    6
    0 評價
    6 貼文
    559 瀏覽
    M
    @xinyangme sorry I don't understand your last question.
  • How to register a custom QML type in a visual studio project?

    Solved
    4
    0 評價
    4 貼文
    704 瀏覽
    ShenCS
    It works with the function qmlRegisterType. Literally appreciate your help @fcarney . It had bothered me quite a lot.
  • PathView Animation

    Unsolved
    2
    0 評價
    2 貼文
    447 瀏覽
    X
    Have you solved the current problem? I have the same problem but don't know how to fix it.
  • Customised virtual keyboard in QT not working

    Unsolved
    3
    0 評價
    3 貼文
    933 瀏覽
    S
    Thanks for the reply. I tried above solution but its not working after adding above lines even keyboard is not visible. Let me how to fix this issue. [image: 365144a8-cdf8-48ea-97af-b445497225f4.jpg]
  • The QML-Element DelegateModelGroups seems to be a cause for a segmentation fault (Qt 5.12.6)

    Solved
    2
    0 評價
    2 貼文
    161 瀏覽
    M
    Hello, Problem reproduced witH Qt 5.15.2. Informed Qt-Support. Qt-Support could reproduce the problem. Regards
  • Zoom/Scale into a desired image mask

    Unsolved
    1
    0 評價
    1 貼文
    177 瀏覽
    尚無回覆
  • ListView contentHeight keeps changing

    Unsolved
    1
    0 評價
    1 貼文
    290 瀏覽
    尚無回覆
  • Where did Settings QML type go in 6.2?

    Unsolved
    3
    0 評價
    3 貼文
    373 瀏覽
    C
    Ah - figured this out. The pypi dist for PySide6 includes Qt C++ shared libs and the Qt.labs.settings QML type. venv/lib/python3.8/site-packages/PySide6/Qt/lib/libQt6LabsSettings.so.6 And just to make life difficult the pypi PyQt6 dist does not.
  • QML: Shape-Shifting Delegates with GridView

    Unsolved
    1
    0 評價
    1 貼文
    166 瀏覽
    尚無回覆
  • Canvas redraw immediately

    Unsolved
    1
    0 評價
    1 貼文
    215 瀏覽
    尚無回覆
  • Problems with QImageIOHandler and Image in QML Qt6

    Unsolved
    2
    0 評價
    2 貼文
    174 瀏覽
    SGaistS
    Hi and welcome to devnet, For number 3, a 7Mb jpeg file is its place on the disk. In order to show its content on screen it must first be uncompressed and that size can change quite a lot. As for your other issues, do you something specific that requires some help ? This is a user forum, if you have some specific bug and a way to reproduce it, then the bug tracker would be the right place to report it.
  • learn Qt Quick & QML

    Unsolved
    4
    0 評價
    4 貼文
    562 瀏覽
    Volodymyr14V
    #python #qt #qml #pyqt #pyside #sql #nosql The best book for developers who want to learn Qt for Python! Python, Qt, and C++ with examples. QML and Qt Quick with examples. PyQt and PySide with examples. Graphics, Graphical Effects, and Multimedia. Working with Databases (SQL, NoSQL). Signals, slots, and event handlers with examples. Threading and Multiprocessing in examples of large-scale constructions. Only by the following link is available the original PDF book "Hands-on Qt for Python Developers" from the original Author, and only here for $3 (Crypto is available): https://workwith.pythonanywhere.com/buy_book
  • No supported platforms for Qt Quick

    Unsolved
    2
    0 評價
    2 貼文
    314 瀏覽
    leenamiettinenL
    The mechanism for showing that information seems to be broken somehow. However, it is just information to help you pick a wizard template that generates a project that you can build for a specific platform. It not being shown does not mean that you cannot build your app for Android. Did you try clicking the Run button to build and run your project for Android? Your settings look good to me. Here you can find some more information about the project wizard templates and using Qt Creator to develop apps for Android devices: https://doc.qt.io/qtcreator/creator-project-creating.html https://doc.qt.io/qtcreator/creator-running-targets.html https://doc.qt.io/qtcreator/creator-mobile-platforms.html#android
  • How to access data from Qabstractlistmodel QList<object> to Qml instead of call each rolecall

    Unsolved
    3
    0 評價
    3 貼文
    912 瀏覽
    S
    @arun-holoplot thanks for the Replay I am new Qt/Qml could you provide any example for wrap it inside a QObject subclass with Q_PROPERY's and use only one role and return that object from the model class in data() if i am loading dynamic data Qlist which method will be the fastest method to get the Data in qml (intract QML with each role or QObject subclass with Q_PROPERY's with one role) note:- if have more than 15 roles
  • How to access Qlist of structure elements in QML

    Unsolved
    1
    0 評價
    1 貼文
    247 瀏覽
    尚無回覆
  • Query: How to design single UI binary to support multiple resolutions

    Solved
    3
    0 評價
    3 貼文
    339 瀏覽
    P
    @jsulm Thank you for your information
  • Issue with fonts in Qt 5.15.1

    Solved
    2
    0 評價
    2 貼文
    369 瀏覽
    P
    The fix is in graphics driver. Please refer below link for more information on the graphics driver https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1060753/am4378-flickering-issue-on-qt-with-eglfs-instance
  • QML show Text and gif in QML Text Element like weibo

    3
    0 評價
    3 貼文
    1k 瀏覽
    L
    @cuongkjm You could simply make a Row and use the AnimatedImage in the center: Row { spacing: 5 Text{ id: text anchors.verticalCenter: parent.verticalCenter text: "Qt Project is very useful" } AnimatedImage { anchors.verticalCenter: parent.verticalCenter height: text.height * 2.5 fillMode: Image.PreserveAspectFit source: "https://doc.qt.io/qt-5/images/pathview.gif" } Text{ anchors.verticalCenter: parent.verticalCenter text: "I like it very much" } }