Skip to content
  • 0 Votes
    2 Posts
    35 Views
    QjayQ

    hey solved using installing following qml packages too

    sudo apt install qml-module-qtquick-extras qml-module-qtquick-controls
  • 0 Votes
    1 Posts
    80 Views
    No one has replied
  • 0 Votes
    2 Posts
    208 Views
    Q

    To be more specific, I have a simple tab bar in a applicationWindow like this :

    ApplicationWindow{ id:root width: 800 height: 480 visible: true title: qsTr("Test") SwipeView { id: swipeView anchors.fill: parent currentIndex: tabBar.currentIndex PageAccueil {} PagePcl {} Page3Form {} } footer: TabBar { id: tabBar Material.accent: "#ff9b22" height: 40 currentIndex: swipeView.currentIndex TabButton { text: qsTr("Page 1") } TabButton { text: qsTr("Page 2") } TabButton { text: qsTr("Page 3") } } }

    Here in window, when I click on the footer , the ripple is inside the tab button I clicked on, as it should be. But on linux like I said before the ripple effect is going at the top right of the application.

  • 0 Votes
    6 Posts
    215 Views
    S

    I solved it. It turns out, I uses same listdata to both models, I need to make new listdata, and pass it to the second model. So models don't share same list data. problem solved.

  • 0 Votes
    3 Posts
    592 Views
    L

    @jeremy_k

    Thank You for the explanation!

    As you said I had to implement the roleNames() Function and adjusted the data().

    The code below now works

    import sys import typing import PySide6 from PySide6 import QtCore from PySide6 import QtGui from PySide6.QtCore import QByteArray class ProductListModel (QtCore.QAbstractListModel): def __init__(self, products, parent = None): super().__init__(parent) self.products = products def data(self, index, role): """Returns an appropriate value for the requested data. If the view requests an invalid index, an invalid variant is returned. Any valid index that corresponds to a string in the list causes that string to be returned.""" row = index.row() if not index.isValid() or row >= len(self.products): return None product = self.products[row] if role == QtCore.Qt.DisplayRole: return product.name elif role == QtCore.Qt.EditRole: return product.name elif role == QtCore.Qt.UserRole + 1: return product.id elif role == QtCore.Qt.UserRole + 2: return product.name return None def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole): """Returns the appropriate header string depending on the orientation of the header and the section. If anything other than the display role is requested, we return an invalid variant.""" if role != QtCore.Qt.DisplayRole: return None if orientation == QtCore.Qt.Horizontal: return f"Column {section}" return f"Row {section}" def rowCount(self, parent: typing.Union[PySide6.QtCore.QModelIndex, PySide6.QtCore.QPersistentModelIndex] = ...) -> int: # return length of productList return len(self.products) def roleNames(self): roles = { QtCore.Qt.UserRole + 1: b'id', QtCore.Qt.UserRole + 2: b'name', } return roles class Product: def __init__(self, id:int, name:str): self.id = id self.name = name```
  • 0 Votes
    3 Posts
    1k Views
    U

    To add an icon to your qt quick app just follow these 2 easy steps:

    open the .qrc file where you have added your static images.

    If you don't have a qrc file in your project then do the following.

    This is the GUI way.
    ->Open your project in qt creator.
    ->Add new qt resources file, then open this file in your editor
    ->Press add files button and search and select your icon.
    ->Save the qrc file.

    Text Editor Way
    ->Open your qrc file in your favorite text editor and add the following lines.

    <RCC> <qresource prefix="/"> <file>images/logo.png</file> </qresource> </RCC>

    Note the qrc file must be added in the CMakeLists.txt file if you are using cmake or .pro file if you are using qmake.

    Open your main.cpp #include <QGuiApplication> #include <QIcon> int main(int argc, char** argv) { QGuiApplication app(argc, argv); QGuiApplication::setWindowIcon(QIcon(":/images/logo.png")); // next do whatever is needed. }
  • 0 Votes
    3 Posts
    267 Views
    O

    @qtmsfp everything setted

  • Qt6 CMake for QML

    Unsolved Qt 6
    1
    0 Votes
    1 Posts
    204 Views
    No one has replied
  • 0 Votes
    2 Posts
    235 Views
    SGaistS

    Hi,

    Might be a silly idea (and I currently don't know the performance hit for that one) but why not have one mouse area per Text object ?

  • 0 Votes
    2 Posts
    440 Views
    B

    If I understood correctly, you want to draw a red line.
    The purpose of Path is to position elements through a path. Think of a row or a column that's not straight. You can understand better if you run the first example from this tutorial.

    To draw paths you need Shape.

    import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Shapes 1.12 Window { width: 640 height: 480 visible: true title: qsTr("Редактор персонажей") Shape { ShapePath { strokeColor: "red"; // it works :) startX: 0; startY: 100 PathLine { x: 640; y: 480 } } } }
  • 0 Votes
    6 Posts
    502 Views
    M

    @vinaygopal
    Sorry I know nothing about QML.

  • 0 Votes
    1 Posts
    155 Views
    No one has replied
  • 0 Votes
    4 Posts
    397 Views
    B

    @vinaygopal

    "what if i want to access the visibility or a property i have defined in the delegate?"

    There are multiple instances of your delegate, corresponding to the part of the model being displayed. Which instance do you want the property from? If it's a common property that is not specific to a single instance, then the same answer applies - factor it out to the table level and use it in the delegate. If it is a property specific to a delegate instance you are interested in, how do you specify which delegate? Does the data actually belong to the model?

    What is it that you are trying to achieve?

  • 0 Votes
    2 Posts
    421 Views
    KroMignonK

    @Osama-Adel Please add Android SDK Command-line Tools, it is required to enable android build with QtCreator

  • 0 Votes
    13 Posts
    7k Views
    A

    @SGaist Ok, thank you. I'll give it a go

  • 0 Votes
    4 Posts
    334 Views
    T

    Still looking for a solution