Solved

In a QT QLineEdit class - is it possible to have more than one input mask?

Posted on 2010-08-17
5
891 Views
Last Modified: 2013-11-23
Hello,

I have a QT project which uses a QLineEdit class.

What I want to do, spedifically, is to have the user be able only to input a time value (ie:  "12:34:26") OR a singel "*" character to indicate a wildcard.

I can restrict the user to either by using the the setInputMask function.  However, I cannot do both at the same time.

Thanks in Advance,
Tim
0
Comment
Question by:tmitch68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:irfan_omair
ID: 33456730
Hi
Did you try using QTimeEdit class, does this solve your problem? If not let me know I will work further to help you.
0
 

Author Comment

by:tmitch68
ID: 33456887
Thanks - that actually does help a lot to use a QTimeEdit class rather than a QLineEdit class with an input mask.  The formatting is much better/easier.

Is there any way to allow the user to type in a single "*" value, though - to signify a wildcard.

If not, I'll still give you credt.

Thanks,
Tim
0
 
LVL 7

Accepted Solution

by:
irfan_omair earned 500 total points
ID: 33457257
Do you want to show both time and ' * ' ?? If yes I am afraid that will not be possible without breaking QDateTime properties which are required to show time in any format and it will require hell of the work as you will have to re write several virtual function.

If time and * bother are needed in same line edit I suggest to use QLineEdit and append time value and * in one string and display that , this will be much easier than hacking QTimeEdit to show * in that .
0
 

Author Comment

by:tmitch68
ID: 33457319
Actually - I just found something that DOES allow the user to put in either a time value or a '*' value - just call the setSpecialValue("*") function on the QTimeEdit class when you create it - it then allows the user to type in whatever they've passed in as a parameter (a single '*' char in this case).

Thanks - I would not have figured this out if you had not suggested going with a QTimeEdit class.
0
 
LVL 7

Expert Comment

by:irfan_omair
ID: 33457345
Thats great I m glad you got it working.
I was looking directly in the code and I found it needs hell of the things to do.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question