Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6083499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:24:35+00:00 2026-05-23T11:24:35+00:00

i create a project under QTCreater. i want to save all the errors in

  • 0

i create a project under QTCreater. i want to save all the errors in a log file
and send it to the program support to solve these errors.

what i mean is to auto generate the file and auto send it when error appear. i have more than 20 source file i don’t like in each method to call a function to insert data in the file and save it. what’s i need is to do as filters in grails applications

is there a way to do that?

thx for you help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:24:36+00:00Added an answer on May 23, 2026 at 11:24 am

    i use this scenario try it may help you:

    1- create a form that has 2 buttons one to start recording and other to stop. (record form)

    2- declare a pointer of type record form in the header, and create a new instance in th constructor.

    3- in the record form there is 2 methods and one variable:

    in header:

    private
    QString fileName;
    

    in constructor:

    conf = new conf(this);
    connect(ui->btnStartRecording,SIGNAL(clicked()),this,SLOT(on_btnStartRecording_clicked()));
    connect(ui->btnStopRecording,SIGNAL(clicked()),this,SLOT(on_btnStopRecording_clicked()));
    

    first method:

    void record::on_btnStartRecording_clicked(){
            fileName = QFileDialog::getSaveFileName(this, tr("Save As"), ".log");
            if (!fileName.isEmpty()){
                if (!fileName.contains(".log")){
                    fileName = fileName + ".log";
                }
                    conf->open_close_file(fileName,true);
                    QMessageBox::warning(this, "Start Recording", "Start Recording");
                    ui->btnStartRecording->setDisabled(true);
                    ui->btnStopRecording->setDisabled(false);
            }
       }
    

    second method:

    void record::on_btnStopRecording_clicked(){
            if (!fileName.isEmpty()){
                    conf->open_close_file(fileName,false);
                    QMessageBox::warning(this, "Stop Recording", "Stop Recording");
                    ui->btnStartRecording->setDisabled(false);
                    ui->btnStopRecording->setDisabled(true);
            }
     }
    

    4- conf is a class that has another 2 methods and 1 variable:

    variable:

    QFile *file;
    

    first method:

    void conf::open_close_file(QString fileName, bool boolFlag){
    if (boolFlag == true){
        file->setFileName(fileName);
        if(file->open(QFile::WriteOnly | QFile::Text)){
        }
    }else{
        file->close();
        file->setFileName("");
    }
    }
    

    second method:

    void conf::write_in_file(QString data){
    if (flag == true){
       QDateTime time;
       QString dataEntry = ">>>  " + time.currentDateTime().toString("dd/MM/yyyy [hh:mm:ss.zzz]") + ": " + data;
       QByteArray byte;
       byte.append(dataEntry);
       QDataStream out(file);
       out<<byte<<"\n";
    }
    }
    

    5- call write_in_file method in each method you want to save any error occurs in it.

    6- finally click on stop record and open the file to see the result

    Note:

    a- boolflag used to differ a method call for open or close the file.

    b- you can close the record form after you click on the start button and work on your program to have an error then open it another time and click stop (you must use this.accept and this.reject)

    hope this may help you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CruiseControl.net creates (by default) for each project a subdirectory under: c:\Program File\CruiseControl.NET\server How can
I am trying to create and use jar file in an Android project under
How to create a project in WebLogic Workshop (version 10.3) with support for JPA
I want to create a project that uses source files already on my filesystem,
When I create a new project in Eclipse from SVN all the files are
I have an ASP.NET project under development with my team. and I want to
I created a folder in a TFS Project under workspace CPortalWS. I deleted the
In ZF you create a project by running this command: zf create project MyProjectName
I'm trying to learn how to use lift. I can create project skeleton by
i create some project but when start App. How to Run this App one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.