|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
[Qt + Visual Studio 2010] Qt Add-in
Ho deciso di usare Visual C++ come compilatore per C++ su Windows perchè è di gran lunga il più compatibile con le varie librerie esterne che mi sono trovato ad utilizzare negli anni.
Fino a VS2008 però, l'ambiente di sviluppo lasciava molto a desiderare... in particolare l'autocompletamento (Intellisense). Ora pare che l'abbiano molto migliorato. Il mio problema è: qualcuno conosce dei modi per far funzionare l'attuale add-in delle Qt su VS2010? Avevo letto che rilasceranno una versione compatibile con le Qt 4.7... conoscete la data di rilascio precisa? TIA |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Purtroppo tocca aspettare l'uscita della 4.7, prevista per l'autunno inoltrato, per l'integrazione con VS2010.
Purtroppo del plugin non vengono rilasciati i sorgenti quindi il porting anticipato non è possibile... Al momento mi arrangio usando QtDesigner per l'editing dei file ui in contemporanea con VS2010 (per crerare i progetti invece ricorro ancora a VS2008, avere la configurazione automatica è troppo comodo) |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Aug 2006
Città: Trieste
Messaggi: 5568
|
Perche' non provi direttamente Qt creator? Io lo uso su linux e devo dire che mi trovo benissimo. In alternativa puoi provare Netbeans che ha il supporto alle librerie QT.
__________________
You should never let your fears become the boundaries of your dreams. |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Quote:
Netbeans è un pezzo che non lo uso come editor per C++, ma anche all'epoca era molto macchinoso. |
|
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Aug 2006
Città: Trieste
Messaggi: 5568
|
In che senso macchinoso? cmq de gustibus :P
__________________
You should never let your fears become the boundaries of your dreams. |
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
QtCreator non mi riconosceva del codice con template che ho compilato tranquillamente sia su VS che su NetBeans, mentre in NetBeans 6.9 non funzionava la creazione di progetti Qt...
inoltre, MinGW consente l'utilizzo di estensioni non standard del C++, cosa che complica molto la migrazione verso altri ambienti di sviluppo la soluzione sarebbe VS2008 + Qt Add-in, ma non si può lavorare senza l'Intellisense di VS2010 se dovrò implementare qualche GUI prima di questo autunno, farò come l'ultima volta: userò VS2010 con quella fogna di MFC... Thanks! |
|
|
|
|
|
#7 | |
|
Senior Member
Iscritto dal: Aug 2006
Città: Trieste
Messaggi: 5568
|
Quote:
__________________
You should never let your fears become the boundaries of your dreams. |
|
|
|
|
|
|
#8 | |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Quote:
Poi considera che sarebbe solo per un breve periodo di transizione, il progetto sicuramente avrebbe una vita ben più lunga di questi pochi mesi all'uscita delle 4.7. |
|
|
|
|
|
|
#9 | |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Quote:
Gran lavoro le WPF, ma limitate a Windows, infine c'è bisogno anche di Blend, ad ogni nuova versione devi avere l'ultimo Visual Studio e l'ultimo Blend. Insomma la spesa si fa consistente. |
|
|
|
|
|
|
#10 | |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
Posta un po' il codice... Che intendi ? Ultima modifica di cionci : 28-07-2010 alle 19:00. |
|
|
|
|
|
|
#11 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
|
|
|
|
|
|
#12 | |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
Quote:
Codice:
//********************* Random<T> class *****************************
/*
generates random numbers
minValue <= x < maxValue
*/
template<typename T>
class Random{
protected:
T minValue, maxValue;
virtual void init( T minValue, T maxValue );
virtual void randomize();
public:
Random<T>( T maxValue ); // 0 < maxValue
Random<T>( T minValue, T maxValue ); // minValue < maxValue
virtual T getRandomNumber();
};
//***************** RandomIntegerBoost class ************************
/*
uses boost library randomness
*/
// typedef for boost library random number generation
typedef boost::mt19937 base_generator_type;
typedef boost::uniform_int<> distribution_type;
typedef boost::variate_generator<base_generator_type &,
distribution_type> variate_generator_type;
class RandomIntegerBoost: public Random<int>{
// boost library random number generation
base_generator_type * generator;
distribution_type * distribution;
variate_generator_type * die;
virtual void init( int minValue, int maxValue );
void randomize();
public:
RandomIntegerBoost( int maxValue ); // 0 < maxValue
RandomIntegerBoost( int minValue, int maxValue ); // minValue < maxValue
~RandomIntegerBoost();
int getRandomNumber();
};
Codice:
void f( int dimension ){
int array[dimension];
...
}
ho letto che un'operazione simile è consentita in un'estensione particolare del C++ |
|
|
|
|
|
|
#13 |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
|
|
|
|
|
|
#14 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
riassumendo la mia posizione in merito a MinGW vs VC++: preferisco il 2° perchè non compila codice non-standard, così si scrive direttamente tutto in una forma accettabile da altri compilatori |
|
|
|
|
|
#15 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
e poi, scusate se spammo sul mio stesso thread... ma questo è il mio 200° messaggio sul forum di HWUpgrade
|
|
|
|
|
|
#16 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
|
|
|
|
|
|
#17 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
bene...
mò mi ritiro in attesa delle Qt 4.7 e ringrazio ancora tutti quelli che mi hanno risposto |
|
|
|
|
|
#18 | |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
|
|
|
|
|
|
|
#19 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Tornando al template che non ti viene compilato: ma l'implementazione del template dov'è ?
|
|
|
|
|
|
#20 |
|
Senior Member
Iscritto dal: Aug 2008
Messaggi: 382
|
qua c'è l'implementazione delle classi template
Codice:
//******************** Random<T> methods **************************
template<typename T>
void Random<T>::randomize(){
// initialize random seed
srand( (unsigned int)( time( NULL ) ) );
// ignore first number ( time dipendent )
int _ = rand();
}
template<typename T>
void Random<T>::init( T minValue, T maxValue ){
this->minValue = minValue;
this->maxValue = maxValue;
randomize();
}
template<typename T>
Random<T>::Random( T maxValue ){ init( 0, maxValue ); }
template<typename T>
Random<T>::Random( T minValue, T maxValue ){ init( minValue, maxValue ); }
template<typename T>
T Random< T >::getRandomNumber(){
return (T)( ( (maxValue-minValue)*(double)rand()/(double)(RAND_MAX) ) +
minValue ) ;
}
//**************** RandomIntegerBoost methods ***********************
void RandomIntegerBoost::randomize(){
/*
Change seed to something else.
Caveat: std::time(0) is not a very good truly-random seed.
When called in rapid succession, it could return the same
values, and thus the same random number sequences could ensue.
If not the same values are returned, the values differ only
slightly in the lowest bits. A linear congruential generator
with a small factor wrapped in a uniform_smallint will
produce the same values for the first few iterations.
This is because uniform_smallint takes only the highest bits
of the generator, and the generator itself needs a few
iterations to spread the initial entropy from the lowest bits
to the whole state.
*/
generator->seed( static_cast<unsigned int>( time( NULL ) ) );
}
void RandomIntegerBoost::init( int minValue, int maxValue ){
/* the seed is unsigned, otherwise the wrong
overload may be selected when using mt19937
as the base_generator_type */
generator = new base_generator_type( (unsigned int)time( NULL ) );
/* uniform random number distribution of
integer values in [ minValue, maxValue ) */
distribution = new distribution_type( minValue, maxValue-1 );
die = new variate_generator_type( *generator, *distribution );
}
RandomIntegerBoost::RandomIntegerBoost( int maxValue ):
Random<int>( maxValue ){ init( 0, maxValue ); }
RandomIntegerBoost::RandomIntegerBoost( int minValue, int maxValue ):
Random<int>( minValue, maxValue ){ init( minValue, maxValue ); }
RandomIntegerBoost::~RandomIntegerBoost(){
delete die;
delete distribution;
delete generator;
}
int RandomIntegerBoost::getRandomNumber(){
return (*die)();
}
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 09:23.




















