Results 1 to 20 of 21

Thread: Facing problem in creating new cpp and Header file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2013
    Posts
    46
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    6

    Default Facing problem in creating new cpp and Header file

    I want to create cpp and header file for this function.
    Qt Code:
    1. void MainWindow::labtext()//labeltext function
    2. {
    3. if(cursor.block().text().contains("",Qt::CaseInsensitive))
    4. {
    5. ui->label->setText("");
    6.  
    7. }
    8.  
    9.  
    10. if(cursor.block().text().contains("printf",Qt::CaseInsensitive)&& cursor.block().text().contains("(",Qt::CaseInsensitive)||cursor.block().text().contains("cout",Qt::CaseInsensitive)&&cursor.block().text().contains("<<",Qt::CaseInsensitive))
    11. {
    12. ui->label->setText("Printing to Standard Output");
    13. }
    14.  
    15. else if(cursor.block().text().contains("while",Qt::CaseInsensitive)&& cursor.block().text().contains("(",Qt::CaseInsensitive))
    16. {
    17. ui->label->setText("Checking condition for While Statement");
    18. //QMessageBox::critical(this,"oo","fdgffh");
    19. }
    20.  
    21.  
    22.  
    23.  
    24. else if(cursor.block().text().contains("switch",Qt::CaseInsensitive)&&cursor.block().text().contains("(",Qt::CaseInsensitive))
    25. {
    26. ui->label->setText("Checking condition for Switch Statement");
    27. }
    28. else if(cursor.block().text().contains("if",Qt::CaseInsensitive)&&cursor.block().text().contains("(",Qt::CaseInsensitive)&&(!cursor.block().text().contains(";",Qt::CaseInsensitive)))
    29. {
    30. ui->label->setText("Checking condition for If Statement");
    31. }
    32. else if(cursor.block().text().contains("else",Qt::CaseInsensitive)&& cursor.block().text().contains("if",Qt::CaseInsensitive))
    33. {
    34. ui->label->setText("Checking condition for If Statement");
    35.  
    36. }
    37.  
    38. else if(cursor.block().text().contains("else",Qt::CaseInsensitive))
    39. {
    40. ui->label->setText("Checking condition for Else Statement");
    41.  
    42. }
    43. }
    To copy to clipboard, switch view to plain text mode 
    Can anybody help me?
    I tried this code:
    Qt Code:
    1. // For header file
    2.  
    3. #ifndef LABELTEXT_H
    4. #define LABELTEXT_H
    5.  
    6.  
    7. #include <QLabel>
    8.  
    9.  
    10. class QLabel;
    11.  
    12. class Labeltext : public QLabel
    13. {
    14. Q_OBJECT
    15.  
    16. public:
    17. Labeltext(QLabel *parent = 0);
    18.  
    19. protected:
    20. void labtext();
    21.  
    22. private:
    23.  
    24. };
    25.  
    26. #endif // LABELTEXT_H
    To copy to clipboard, switch view to plain text mode 

    but in cpp file i dont know what to include in constructor?
    Last edited by anda_skoa; 29th January 2014 at 12:59. Reason: add code tags

Similar Threads

  1. Qt Creator PROBLEM INCLUDING 'QSystemInfo' HEADER FILE
    By Rakula in forum Qt Tools
    Replies: 1
    Last Post: 24th September 2010, 09:28
  2. I am facing a problem please help me !
    By sujan.dasmahapatra in forum General Programming
    Replies: 3
    Last Post: 16th September 2009, 14:12
  3. 'QFile' Header File Problem
    By hasnatzaidi in forum Qt Programming
    Replies: 2
    Last Post: 11th June 2009, 21:40
  4. Facing problem with Q3Canvas
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 6th May 2006, 07:00
  5. Facing problem with qt-4.1 designer
    By jnana in forum Qt Tools
    Replies: 4
    Last Post: 8th March 2006, 18:16

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
  •  
Qt is a trademark of The Qt Company.