Which String Class in Qt Should I Use?

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ค. 2024
  • Qt comes with lots of classes relating to strings these days, including QString, QStringView, QStringLiteral etc.
    Actually, it comes with so many that I lost track, so maybe it is time to call my good friend Peppe.
    In this episode we will discuss what you need to know to get it right at least 95% of the cases, without knowing it all.
    Links:
    * Detailed documentation on QStringBuilder: www.qt.io/blog/2011/06/13/str...
    * Before you use QStringBuilder make sure you can answer question 2 here: www.kdab.com/20years-challenge/
    0:00 Introduction
    1:25 Use QString
    2:03 So why do we have all these classes?
    2:57 Overview of the classes
    3:27 QStringLiteral
    5:00 QString::operator==() has improved a lot
    8:13 QByteArray
    9:50 QLatin1Stringm QLatin1StringView
    12:29 Views - QStringRef (Qt5), QStringView
    16:18 Lifetime of views
    All QML tips and tricks videos : • QML Tips and Tricks
    All Qt Widgets and more videos:
    • Qt Widgets and more
    About the host:
    The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core - Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.
    Every month our newsletter is featuring technical blogs on Qt, C++ and 3D topics: www.kdab.com/development-reso...
    About KDAB:
    KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. www.kdab.com/software-services
    KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrolment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.
    Contact us to find out more at training@kdab.com or visit our website: www.kdab.com/software-service...
    We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. www.kdab.com/about/contact/
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 6

  • @saransekhar6618
    @saransekhar6618 ปีที่แล้ว

    Super great video makes excited to learn more and get started! Love the "stay organized" motto !!

  • @piergiorgiovalli5220
    @piergiorgiovalli5220 ปีที่แล้ว

    Nice Topic!

  • @trevorremien9929
    @trevorremien9929 ปีที่แล้ว

    I've been struggling to find an soft soft tutorial. I haven't watched yours yet but if the actual company is telling you nice job, then I'm

  • @timangus
    @timangus ปีที่แล้ว +1

    I wonder if it's feasible for a rule to be implemented in clazy that recommends places where QStringView could/should be used in place of QString/const QString&. (If it doesn't exist already.)

    • @giuseppedangelo3015
      @giuseppedangelo3015 ปีที่แล้ว +1

      Hi! Peppe from KDAB here. In principle it could be possible, but it's not exactly easy to specify a rule which is at the same time correct and complete. Consider a function that takes a QString parameter. How do you established if it can be replaced by a QStringView? As soon as that parameter is passed to any other function that takes a QString, or if data() is called it on it, or even iterators are obtained from the string, then you no longer really know if the replacement can be safely made or not. In other words, the applicability of such an automatic check would be extremely low...

    • @timangus
      @timangus ปีที่แล้ว

      @@giuseppedangelo3015 Fair points. There must be an awful lot of QString argument setter functions out there that do nothing besides set a member variable though. Such a test would be valuable for making those replacements... not that I'm volunteering to implement it ;).