lupdate not adding entries to .ts files
-
Here's the entry that wasn't added:
setToolTip(tr("You can use the Up-Arrow, Right-Arrow, Left-Arrow, Down-Arrow;\n" "Page-Up and Page-Down keys to move a slider after you have selected it\n" "with the mouse."));
it's perfectly valid C++ but I suspected lupdate was tripping up on the character string split over several lines.
So I tried this:
setToolTip(tr("You can use the Up-Arrow, Right-Arrow, Left-Arrow, Down-Arrow;\n\ Page-Up and Page-Down keys to move a slider after you have selected it\n\ with the mouse."));
but that didn't work either, so I tried:
setToolTip(tr("You can use the Up-Arrow, Right-Arrow, Left-Arrow, Down-Arrow;\nPage-Up and Page-Down keys to move a slider after you have selected it\nwith the mouse."));
sad to say that too failed.
Yes the header file has Q_OBJECT:
class QLinearGradientCtrl : public QWidget { Q_OBJECT Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient) Q_PROPERTY(int gradientWidth READ gradientWidth WRITE setGradientWidth) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation) Q_PROPERTY(int selectedPeg READ selected WRITE setSelected NOTIFY pegSelChanged) Q_PROPERTY(QGradientStop selectedStop READ selectedStop) Q_PROPERTY(bool pegsOnLeftOrBottom READ pegsOnLeftOrBottom WRITE setPegsOnLeftOrBottom) Q_PROPERTY(bool pegsOnRightOrTop READ pegsOnRightOrTop WRITE setPegsOnRightOrTop) Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips) typedef QWidget Inherited;
David
-
As always - minimize your code until the problem goes away or you can show us a minimal reproducer.
-
Are you sure, everything is as it should be ?
Base class properly initialised ?
Q_OBJECT and not Q_GADGET used ?
tr() function in the actually scope of the class (QLinearGradientCtrl) and not in a lambda or such shenanigans ?use QCoreApplication::translate() and provide your own context scope
-
Yes I used Q_OBJECT and yes the class is initialised. In the end I gave up and use QCoreApplication::translate("QLinearGradientCtrl", "text") as tr("text") wasn't working.
QLinearGradientCtrl::QLinearGradientCtrl(QWidget * parent, QColor start, QColor end) : QWidget(parent), m_Gradient(0, 0, 1, 0), m_Width(GCW_AUTO), selectedPeg(NONE), lastSelectedPeg(NONE), m_LastPos(0), m_showToolTips(true), m_Orientation(Orientation::Auto), startPegStop(0), m_LeftDownSide(true), m_RightUpSide(false) { m_ToolTipFormat = "&SELPOS\nPosition: &SELPOS Colour: R &R G &G B &B\nColour: R &R G &G B &B\nColour: R &R G &G B &B\nDouble Click to Add a New Peg"; //m_Impl = new QLinearGradientCtrlImpl(this); m_Gradient.setColorAt(0, start); m_Gradient.setColorAt(0.001, start); m_Gradient.setColorAt(0.999, end); m_Gradient.setColorAt(1, end); setFocusPolicy(Qt::StrongFocus); // Make sure we get key events. stops = m_Gradient.stops(); // Grab the gradient stops endPegStop = stops.size() - 1; setToolTip(QCoreApplication::translate("QLinearGradientCtrl", "You can use the Up-Arrow, Right-Arrow, Left-Arrow, Down-Arrow;\n" "Page-Up and Page-Down keys to move a slider after you have selected it\n" "with the mouse.")); }
Is how it now reads...