Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. lupdate not adding entries to .ts files
Forum Updated to NodeBB v4.3 + New Features

lupdate not adding entries to .ts files

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 3 Posters 536 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    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

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      As always - minimize your code until the problem goes away or you can show us a minimal reproducer.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        All I have to add is that lupdate said:

        QLinearGradientCtrl.cpp:46: tr() cannot be called without context

        Does that guide me to a solution?

        1 Reply Last reply
        0
        • J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          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


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by Perdrix
            #5

            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...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved