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

  • Home
  • SEARCH
  • 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 9162913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:19:36+00:00 2026-06-17T14:19:36+00:00

I have QTableWidget with 3 columns. I multiply numbers in first and second column

  • 0

I have QTableWidget with 3 columns. I multiply numbers in first and second column and write result in third column. Numbers are double. The problem is: result is in scientific notation like “1.4e+3”. How can I change notation to standard notation?
I use Qt 4.8 and Ubuntu 12.10.

I populate first two columns:

QTableWidgetItem *itm0=new QTableWidgetItem("12345.6781");
ui->tableWidget->setItem(0,0,itm0);
QTableWidgetItem *itm1=new QTableWidgetItem("223.132");
ui->tableWidget->setItem(0,1,itm1);

I multiply numbers and write result

double num0=ui->tableWidget->item(0,0)->text().toDouble();
double num1=ui->tableWidget->item(0,1)->text().toDouble();
double result=num0*num1;

QTableWidgetItem *itm2=new QTableWidgetItem(QString::number(result));
ui->tableWidget->setItem(0,2,itm2);

result is 2.75472e+06,
but actually result is 2754715,8458092

  • 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-06-17T14:19:37+00:00Added an answer on June 17, 2026 at 2:19 pm

    I suppose you are using QString::number function . You can use the second argument of this function to specify how the conversion from double to QString will be done. Here are the outputs :

    double num = 1234.4565;
    qDebug()<< QString::number(num);//"1234.46" 
    qDebug()<< QString::number(num, 'e');//"1.234457e+03" 
    qDebug()<< QString::number(num, 'f');//"1234.456500" 
    

    Use
    ‘e’ format as [-]9.9e[+|-]999
    ‘E’ format as [-]9.9E[+|-]999
    ‘f’ format as [-]9.9
    ‘g’ use e or f format, whichever is the most concise
    ‘G’ use E or f format, whichever is the most concise
    Assistant is my best friend 😉

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

Sidebar

Related Questions

I have a QTableWidget and the first column contains numbers from 1 to 1000.
I would like to have one column in QTableWidget NOT editable. In forums I
Say I have a QTableWidget with 10 columns. I set data in the table
I have what is hopefully a simple problem using a QTableWidget in Qt Designer
I have a QTableWidget with a number of columns that are only checkboxes (and
I have problem getting selected rows from QTableWidget. I have table like this: [id]
I have a subclass of QTableWidget with the following code: connect(this, SIGNAL(cellChanged(int, int)), this,
Let's consider we have QWidget that contains QTableWidget (only). So we want to resize
I have a QTableWidget and would like that pressing Ctrl while clicking on a
I have a QTableWidget and I can't get anything to show up in it.

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.