Skip to content
  • 143k Topics
    717k Posts
    E

    So, I wanted to implemented a placeholder text for a list (QListView) which would be displayed if the list has no items.

    Currently I'm doing it using QStackedLayout but it requires quite a bit of boilerplate. You need to create a wrapper QWidget that will hold QStackedLayout, and also another wrapper QWidget for placeholder text so it can be centered:

    auto stackedLayoutWrapper = new QWidget(parent); auto stackedLayout = new QStackedLayout(stackedLayoutWrapper); stackedLayout->addWidget(listView); auto placeholderWrapper = new QWidget(); auto placeholderLayout = new QVBoxLayout(placeholderWrapper); auto placeholder = new QLabel("No items"); placeholderLayout->addItem(placeholder, 0, Qt::AlignCenter); stackedLayout->addWidget(placeholderWrapper);

    And then I discovered another neat way to do it, using QListView::viewport():

    auto placeholderLayout = new QVBoxLayout(listView->viewport()); auto placeholder = new QLabel("No items"); placeholderLayout->addWidget(placeholder, 0, Qt::AlignCenter);

    This works right now, but question is, how safe is it set a layout on the viewport() like this?

  • Jobs, project showcases, announcements - anything that isn't directly development
    4k Topics
    23k Posts
    jeremy_kJ

    @michaelcarlos said in Best Way to Optimize a Qt Quick Application for Smooth Performance?:

    Are there any profiling tools that are Qt-specific and will allow me to identify bottlenecks?

    The QML profiler built into Creator (Analyze -> QML Profiler) has worked for me in the past.

  • Everything related to designing and design tools

    122 Topics
    371 Posts
    H

    @Tim-Jenssen
    Thanks for your reply. I got limited resources tracking this issue. Appreciate for your help. If u need more info debugging this from my side, feel free to ask.

  • Everything related to the QA Tools

    72 Topics
    204 Posts
    U

    @jagadish Thank you

  • Everything related to learning Qt.

    384 Topics
    2k Posts
    Ash_QtA
    Introducing the QML for Beginners Learning Path & Challenges!

    Hello Qt Community!

    We're excited to announce the QML for Beginners Learning Path is now available on Qt Academy! This comprehensive learning journey is designed to take you from QML basics to creating engaging, interactive applications using QML.

    What's Included

    The learning path consists of 8 courses, each paired with a hands-on coding challenge:

    Introduction to QML Introduction to Qt Quick Introduction to Qt Quick Controls Positioners and Layouts Model View Delegate with QML QML Best Practice QML Fluid Elements and Animations QML Debugging Basics with Qt Creator

    Each challenge comes with the following:

    A video introduction explaining the requirements A starting project template with resources A video detailing one possible solution Extension Challenge with additional requirements for independent learning

    The first challenge is available now, and the rest will be released every two weeks.

    Share Your Work!

    As you complete each challenge, we invite you to share your work in this post! It's a great way to:

    Get feedback from the Qt community Showcase your progress and creativity Help inspire other learners Document your learning journey

    When sharing your challenge projects, please include:

    Screenshots of your application A link to your repository hosted on GitHub or similar Description of your approach and any obstacles you overcame Which stretch goals you tackled (if any) Any questions you have for the community Getting Started

    Ready to begin? Visit the Qt Academy Course Catalog to enroll in the learning path. The first course, Introduction to QML is a perfect starting point for anyone new to Qt and QML.

    We can't wait to see what you create! Feel free to ask questions and share your progress as you work through the courses and challenges.

    Happy coding!

    ~ Ash and the Qt Academy Team

  • 2k Topics
    13k Posts
    Christian EhrlicherC

    When you want to include some headers of a library you also must pass the include path to the compiler.
    If you use cmake, use target_include_directories() and add the desired include paths there. Later when you use this library (aka you link them with target_link_libraries()), cmake will automatically add the paths specified.

  • 4k Topics
    17k Posts
    X

    刚刚接触QT,菜单直接打开链接到某个文件"

  • This is where all the posts related to the Qt web services go. Including severe sillyness.
    1k Topics
    10k Posts
    E

    They still send you this trash after you unsubscribe. Had to fully block qt in my mail client.

    They are very stupid for not using a mail provider for that spam. Now their URL is being flagged by all of us.