[Qt-interest] C++ or QML

Andre Somers andre at familiesomers.nl
Wed Jun 30 17:12:21 CEST 2010


On 30-6-2010 15:29, BRM wrote:
> ----- Original Message ----
>
>    
>> From: Carsten Breuer<CarstenBreuerQt at textwork.de>
>>      
>>> If you want a component that acts like excel, this is going worse.
>>> In C++ you can do that. what's about QML?
>>> I don't understand the question.
>>>        
>> What i was trying to say is:
>>      
>    
>> If the customer want a grid that behaves like microsoft excel,
>> it is pretty hard to solve this in QT. I had expected that this is
>> a common request to the QT developers, but emulation of different
>> navigation types are not implemented yet and are hard to do so.
>>      
> So you add a delegate to a QTableWidget, and then add the extra behavior you want.
>
> Though honestly I wouldn't call an MS Excel grid a native type - it does require using the MS Excel Active X control at the very least, which you get as part of VisualStudios, but is not necessarily on the Windows platform unless someone else has put it there - either through installing Office or another App that pulled the ActiveX control along. Either way, you should be able to use that ActiveX control through the MFC/ActiveX windows Qt extension (ActiveQt), but (I believe) that requires limiting yourself to Windows.
>
>    
>> Even displaying floats with more then 2 decimal points
>>      
>
> float myValue = 3.1458;
> QString myQStringValue = QString("%1").arg(myValue,0,'f',4');
> QLabel* someLabel = new QLabel(myQStringValue); // or use setText() to update
>
> Or alternatively:
>
> char buffer[1024];
> float myValue = 3.1458;
> snprintf(buffer,sizeof(char)*1024,"%0.4f",myValue);
> QString myQStringValue = QString(buffer);
> QLabel* someLabel = new QLabel(myQStringValue);
>
> Don't know how that isn't so simple...
>
>    
Can be even simpler:
QString myQStringValue = QString::number(myValue, 'g', 4);

No need for char buffers... Also look at QString::sprint(), arg() and 
setNum()

André


-- 
Nokia Certified Qt Developer.
Interested in Qt related job offers or freelance Qt consulting work.




More information about the Qt-interest-old mailing list