Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • 0 Votes
    1 Posts
    825 Views
    No one has replied
  • Qlabel scrolling text

    2
    0 Votes
    2 Posts
    3k Views
    J
    Keep in mind that moving UI elements tend to be rather distracting. Perhaps a tool tip / popup is a better solution to your problem. Anyway here is a simple marquee @ import QtQuick 2.0 import QtQuick.Controls 1.0 Rectangle { width: 360 height: 360 Rectangle { id: marquee width: 100 height: label.height color: "white" clip: true border.color: "lightgray" anchors.centerIn: parent Label { id: label x: 2 text: "Hello I am a very long label" property int scrollLength: (label.implicitWidth - marquee.width) + 4 SequentialAnimation on x { loops: Animation.Infinite NumberAnimation { to: -label.scrollLength ; duration: 2000 ; easing.type: Easing.OutSine} PauseAnimation { duration: 1000 } NumberAnimation { to: 2 ; duration: 2000 ; easing.type: Easing.OutSine} PauseAnimation { duration: 1000 } } } } } @
  • HELP! I want to zoomIn and zoomOut scribble area.

    5
    0 Votes
    5 Posts
    2k Views
    N
    the complete diagramscene example here- http://harmattan-dev.nokia.com/docs/library/html/qt4/graphicsview-diagramscene.html i tried inserting the below mentioned functions into "mainwindow.cpp" of diagramscene .. @ void MainWindow::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { lastPoint = event->pos(); scribbling = true; } } void MainWindow::mouseMoveEvent(QMouseEvent *event) { if ((event->buttons() & Qt::LeftButton) && scribbling) drawLineTo(event->pos()); } void ScribbleArea::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && scribbling) { drawLineTo(event->pos()); scribbling = false; } } void MainWindow::paintEvent(QPaintEvent *event) { QPainter painter(this); QRect dirtyRect = event->rect(); painter.drawImage(dirtyRect, image, dirtyRect); } void MainWindow::resizeEvent(QResizeEvent *event) { if (width() > image.width() || height() > image.height()) { int newWidth = qMax(width() + 128, image.width()); int newHeight = qMax(height() + 128, image.height()); resizeImage(&image, QSize(newWidth, newHeight)); update(); } QWidget::resizeEvent(event); } void MainWindow::drawLineTo(const QPoint &endPoint) { QPainter painter(&image); painter.setPen(QPen(myPenColor, myPenWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.drawLine(lastPoint, endPoint); modified = true; int rad = (myPenWidth / 2) + 2; update(QRect(lastPoint, endPoint).normalized() .adjusted(-rad, -rad, +rad, +rad)); lastPoint = endPoint; } void MainWindow::resizeImage(QImage *image, const QSize &newSize) { if (image->size() == newSize) return; QImage newImage(newSize, QImage::Format_RGB32); newImage.fill(qRgb(255, 255, 255)); QPainter painter(&newImage); painter.drawImage(QPoint(0, 0), *image); *image = newImage; }@
  • Intercepting and relaying touch events to child items

    1
    0 Votes
    1 Posts
    818 Views
    No one has replied
  • Dragging an dynamically created object out of a ListView

    1
    0 Votes
    1 Posts
    555 Views
    No one has replied
  • How to add QML widgets in QGraphicsScene version QtQuick 2.0

    4
    0 Votes
    4 Posts
    2k Views
    sierdzioS
    I don't know why are you using QGraphicsScene, so I don't know which of the alternatives to offer. To combine QtWidgets with QtQuick module, you need to take a look at "createWindowContainer":http://qt-project.org/doc/qt-5.1/qtwidgets/qwidget.html#createWindowContainer() function.
  • This Flickable won't flick or drag

    2
    0 Votes
    2 Posts
    715 Views
    Q
    I found the issue. Because I hard-coded the height of the Flickable's child, the Text element, there was no content larger than the Flickable to scroll through.
  • 0 Votes
    3 Posts
    2k Views
    4
    The order of creation is not guaranteed. In cases where the asynchronous loading does not take the same time per delegate, you could see any random order happening. The difference between qmlscene and qtquick2viewer is odd though, and could be caused by QTBUG-31203. If you prefer the qmlscene like behavior, try using this as your C++ application: @ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); QQuickView v; v.setSource("main.qml"); v.show(); return app.exec(); } @
  • [SOLVED] Resize an Image after rotation to fill it's parent

    5
    0 Votes
    5 Posts
    2k Views
    GianlucaG
    I used the second solution.
  • Memory usage with QtQuick 2.0

    3
    0 Votes
    3 Posts
    1k Views
    O
    Hi Qurx, Don't you think that it could be a memory fragmentation issue ? I'll take a look to find a workaround but... you'll probably need to change your OS version. Bye
  • Own window frame for the application

    4
    0 Votes
    4 Posts
    945 Views
    T
    QWindow has setFlags(), see "the documentation here":http://qt-project.org/doc/qt-5.1/qtgui/qwindow.html#flags-prop
  • QAbstractListModel with QML

    3
    0 Votes
    3 Posts
    7k Views
    S
    hey yudjin, thanks for that example. Yesterday I stumbled upon this one https://qt.gitorious.org/qt/qtdeclarative/source/87d0c02fab03b7d3bf2094af22465f029bcdd096:examples/quick/models/abstractitemmodel . Both examples are pretty helpful in this case.
  • Accessing Image inside a Tab

    2
    0 Votes
    2 Posts
    760 Views
    R
    well, I solved the issue by setting an alias property for image in ScrollView and accessing the ScrollView using the item property of Tab.
  • Setting property based on role

    5
    0 Votes
    5 Posts
    2k Views
    B
    Sort of. I got around the problem by creating custom delegates that I then let handle input. So the table @ TableView { ... TableViewColumn { role: "value"; title: "Value"; delegate: selectDelegate } @ The delegate @ Component { id: selectDelegate Item { function select(model) { switch(model.definition.type) .... // this is just an enum defined in my code return aComponent } Component { id: aComponent // Something that can handle clicking and so forth } Loader { property var localModel sourceComponent: select(model[styleData.row]) Binding on localModel { when: status == Loader.Ready value: model[styleData.row] } } } @ Since I end up with a delegate of my own I get to choose explicitly how localModel maps to my controls. In my case its a property editor so I have multiple types of components to handle color, text, date, etc so you could simplify this down.
  • QML to EXE/without DLL

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Rich Text Link Active Color

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    6 Posts
    5k Views
    P
    Please post additional information about the issues you are facing, specifically as described in - http://gpupowered.org/node/27
  • QProcess not running command correctly & freezing gui

    5
    0 Votes
    5 Posts
    2k Views
    M
    Still only launches easystroke and freezes :(.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    4 Posts
    1k Views
    D
    Thanks, seems it is ok