Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-08-17
5
Medium Priority
?
919 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

610 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