LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2018, 05:35 AM   #1
zentara
LQ Newbie
 
Registered: Jul 2011
Posts: 24

Rep: Reputation: Disabled
qt5 converting QCombBox setCurrentText to setCurrentIndex in qsstv


Hi, I am trying to compile a qt5 app for slow scan tv called qsstv. http://users.telenet.be/on4qz/qsstv/index.html.
I ran into an error where it says:
Code:
./ui_txwidget.h:834:33: error:  ‘class QComboBox’ has no member named ‘setCurrentText’; did you mean ‘setCurrentIndex’?
 drmTxBandwidthComboBox->setCurrentText(QApplication::translate("txWidget", "2.2 kHz", 0, QApplication::UnicodeUTF8));
I encountered 4 of these lines, and after just commenting them out, the app compiles fine. However, I would like to correct the error, because 2.2 kHz is probably an important initial setting, but am not familiar enough with qt, and was wondering if someone could give me the right syntax.

I tried changing setCurrentText to setCurrentIndex, but then got errors about the argument list being of the wrong type.

So, if you would please, what would be the correct syntax to change
Code:
          drmTxBandwidthComboBox->setCurrentText(QApplication::translate("txWidget", "2.2 kHz", 0, QApplication::UnicodeUTF8));
to use setCurrentIndex?

Thank You,
zentara

Last edited by zentara; 08-02-2018 at 05:39 AM.
 
Old 08-02-2018, 07:58 AM   #2
zentara
LQ Newbie
 
Registered: Jul 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
a possible solution

Hi, I hate to be so inept as to answer my own question, but I put on my qt sourceror's apprenctice cap and came up with the following fix. It compiles and seems to work, but I don't know if it is the best solution.
Code:
/* changed setCurrentText  to setItemText with a first arg of 0 */

drmTxBandwidthComboBox->setCurrentText( QApplication::translate("txWidget", "2.2 kHz", 0, QApplication::UnicodeUTF8));
to
drmTxBandwidthComboBox->setItemText(0, QApplication::translate("txWidget", "2.2 kHz", 0, QApplication::UnicodeUTF8));
Any comments or better solutions welcome.
 
Old 08-02-2018, 08:08 AM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,242

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
I don't know why it's not working (I couldn't find any references in Qt's documentation to setCurrentText actually being removed), but it looks like you can fix it by changing the "text" property to the "index" property in the .ui files.

https://forum.qt.io/topic/45373/a-qu...currentindex/2
https://forum.qt.io/topic/5120/qcomb...tcurrenttext/3
 
1 members found this post helpful.
Old 08-02-2018, 09:14 AM   #4
zentara
LQ Newbie
 
Registered: Jul 2011
Posts: 24

Original Poster
Rep: Reputation: Disabled
Hi, I'm using Slackware current from Jul 2018 with qt 5.7.1. I looked thru the links you mentioned plus others, it seems that setCurrentText was deprecated way back in qt4.
http://www.qtcentre.org/threads/8515...-is-deprecated
What thru me off was the error message hinting that I probably should be using setCurrentIndex. setItemText seems to be the better suggestion. I never could figure out what they meant by changing the text and index properties in the .ui files. Thanks for the reply.
 
Old 04-20-2019, 12:40 PM   #5
jonathan018
LQ Newbie
 
Registered: May 2011
Posts: 16

Rep: Reputation: 2
Hello,
Just yesterday updated to qsstv-9.3.3 on slackware64-14.2. Except zentara's function change, also was needed -std=c++11 switch.

73 de YU1IS
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
qdvdauthor for Qt5 pmv Linux - Software 19 05-04-2024 06:58 AM
[SOLVED] Qt5 keybinds orbea Slackware 6 05-14-2018 01:56 PM
[SOLVED] QSSTV no audio error:Unable to open hw:0,0 ALC662 rev1 Analog: Device or resource busy unclejed613 Ubuntu 0 04-17-2018 12:45 AM
[SOLVED] qt5 and pathappend jr_bob_dobbs Linux From Scratch 1 10-14-2017 08:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration