Jump to content

resolved

Go to solution Solved by CookieMaster,
On 5/2/2017 at 8:58 PM, fizzlesticks said:

No. imagedepth should be an int.

I'm confusing my self now...

Should be

int imagedepth = image.depth();

 

ui->depth->setText(QString("Color Depth:").arg(imagedepth));

 

solved by self...

 

 

 

 

image.depth() returns an int, so depth should be an int.

The error you get after that is because it looks like you copy/pasted "depth" in the middle of image.depth() instead of replacing it. It should either just be "depth" or "image.depth()". 

1474412270.2748842

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772810
Share on other sites

Link to post
Share on other sites

5 minutes ago, CookieMaster said:

Can you copy and paste what line or lines  i should be replacing or fixing, sorry this confuses me. 

Don't think I copied it because if i click it it finds the others with depth, also i even re typed it 

The line you say the error is in.

 ui->depth->setText(QString("Color Depth: ").arg(imagedepth.depth()));

you don't have a variable called imagedepth in the original code.

1474412270.2748842

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772838
Share on other sites

Link to post
Share on other sites

Just now, fizzlesticks said:

Again, image.depth() returns an int not a QImage.

So if i do int imagedepth = image.depth();

 

i get request for member 'depth' in 'imagedepth', which is of non-class type 'int'
     ui->depth->setText(QString("Color Depth: ").arg(imagedepth.depth()));

 

Am i missing something or am I just completely clueless today? 

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772851
Share on other sites

Link to post
Share on other sites

1 minute ago, CookieMaster said:

So if i do int imagedepth = image.depth();

 

i get request for member 'depth' in 'imagedepth', which is of non-class type 'int'
     ui->depth->setText(QString("Color Depth: ").arg(imagedepth.depth()));

 

Am i missing something or am I just completely clueless today? 

If you change imagedepth to an int it doesn't have a depth() function anymore. You need to replace imagedepth.depth() with just imagedepth.

1474412270.2748842

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772862
Share on other sites

Link to post
Share on other sites

3 minutes ago, fizzlesticks said:

If you change imagedepth to an int it doesn't have a depth() function anymore. You need to replace imagedepth.depth() with just imagedepth.

QImage imagedepth = image.depth();
ui->depth->setText(QString("Color Depth:").arg(imagedepth));

 

is that what i should be doing?

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772883
Share on other sites

Link to post
Share on other sites

Just now, CookieMaster said:

I'm confusing my self now...

int imagedepth = image.depth();

 


ui->depth->setText(QString("Color Depth:").arg(imagedepth));

 

Is this correct??

That fixes the error you were getting, I don't know enough Qt to tell if what you're doing is correct. Trying running it to find out.

1474412270.2748842

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772918
Share on other sites

Link to post
Share on other sites

Just now, fizzlesticks said:

That fixes the error you were getting, I don't know enough Qt to tell if what you're doing is correct. Trying running it to find out.

Yes it does work, needed to add %1x for the 1 arguement for it to display correctly.

 

Thank you so much!

Link to comment
https://linustechtips.com/topic/774671-resolved/#findComment-9772924
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×