Qt 6 - Episode 9 - QString Basics

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024

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

  • @hansschluter9977
    @hansschluter9977 3 ปีที่แล้ว +4

    28:05 no it does not in your case, due to implicit sharing! It does not copy the data as long as you not write to the passed string!

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

    I'd move the logically related chunks of code ("chapters") to separate functions.
    For example, you can introduce new class 'Utils', and put there all these chapters as static functions:
    class Utils
    {
    public:
    static void createStrings();
    static void playWithCtorsAndArgs();
    static void reachEachCharOneByOne();
    static void compareAndSearch();
    static void modifyAndParse();
    };
    In this case your main function will be clean and short as follows:
    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    // Utils::createStrings();
    // Utils::playWithCtorsAndArgs();
    // Utils::reachEachCharOneByOne();
    // Utils::compareAndSearch();
    Utils::modifyAndParse();
    return a.exec();
    }
    Another one benefit of such approach is that you don't need comments (as names of chapters) anymore, because your functions substitute this functionality by function names. Now the names of the chapters are part of your code, which is considered as 'best practice' - your code is self-explanatory (self-documented) now.

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

    There is range-based for loop since C++11, so, I think, it way much better to use it instead of foreach:
    for (auto const &item : list) { qInfo()

  • @rickarmbruster8788
    @rickarmbruster8788 3 ปีที่แล้ว +2

    The increased quality is superb!

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

    great video, This covers the basics of everything I need to know about QString without having to read the documents.

  • @Ralfountet
    @Ralfountet 2 หลายเดือนก่อน

    I love your work.

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

    Great!
    I wonder how you can convert a QByteArray to a Windows-compatible wchar_t string.

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

    Thank you brother, it's really helpful lesson

  • @amiralnar
    @amiralnar 2 ปีที่แล้ว

    Great video! Thank for making this!

  • @josbexerr5166
    @josbexerr5166 3 ปีที่แล้ว

    Excelente resumen

  • @furiouscyt
    @furiouscyt 3 ปีที่แล้ว

    Awesome e

  • @reipalacio
    @reipalacio 3 ปีที่แล้ว

    very good

  • @master138
    @master138 2 ปีที่แล้ว

    Can i also do that arg() thing with std::string?

    • @Ev3r0x
      @Ev3r0x 2 ปีที่แล้ว +2

      no

    • @alexskatkov2124
      @alexskatkov2124 2 ปีที่แล้ว

      Give a look at std::format.

  • @Arun-wm1cq
    @Arun-wm1cq 3 ปีที่แล้ว

    Nice 💖