how to declare the static QString
-
Hi, I'm using QT5.5 on my computer.
I declare a static QString like below.static QString test_item[9] { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition", };And it will give me an error when i compile it.
Did i miss anything?
Please help! -
This case is also an excellent example of where you want to use QStringLiteral
-
And I would use a
QStringListinstead of a C array -
@JKSH said in how to declare the static QString:
And I would use a
QStringListinstead of a C arrayI raise you
std::array<QString,9>@VRonin said in how to declare the static QString:
@JKSH said in how to declare the static QString:
And I would use a
QStringListinstead of a C arrayI raise you
std::array<QString,9>That's indeed the best of both worlds
-
@JKSH said in how to declare the static QString:
And I would use a
QStringListinstead of a C arrayI raise you
std::array<QString,9>@VRonin said in how to declare the static QString:
@JKSH said in how to declare the static QString:
And I would use a
QStringListinstead of a C arrayI raise you
std::array<QString,9>And I'll answer the problem :-P
remove the last
,thats not supposed to be therestatic QString test_item[9] { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition" }; -
@VRonin said in how to declare the static QString:
@JKSH said in how to declare the static QString:
And I would use a
QStringListinstead of a C arrayI raise you
std::array<QString,9>And I'll answer the problem :-P
remove the last
,thats not supposed to be therestatic QString test_item[9] { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition" }; -
static QString test_item[9] = { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition", };works for me as does
static QString test_item[] { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition", };and
static QString test_item[] = { "Touch", "Panel", "Comport", "USB_SD", "LAN", "CAN", "Audio", "DIDO", "Ignition", };Might be a compiler thing. I'm using Windows mingw which came with 5.9.