How to upgrade plugins in newly upgraded Vaa3D(Qt6) system - Vaa3D/Vaa3D_Wiki GitHub Wiki
1、Add QT += widgets in .pro file of the plugin;
2、Add Q_PLUGIN_METADATA(IID"com.janelia.v3d.V3DPluginInterface/2.1") line below Q_INTERFACES(V3DPluginInterface2_1) line in plugin.h file;
3、annotate this line code in plugin.cpp file;
//Q_EXPORT_PLUGIN2(.., ..);
Above,you can build your plugins successfully.
We have also listed all possible errors that may happen because of the upgrade of Qt environment. And we recommend you solve like this:
error 1 : use of undeclared identifier 'QInputDialog'
#include <QInputDialog>
error 4: ISO C++17 does not allow 'register' storage class specifier
register EdgeTableEntry *pETEchase;
==>
remove register
error 5: C3646: “regExp”: undeclared identifier
#include <QRegularExpression>
QRegExp
==>QRegularExpression
error 6: no member named 'start' in 'QTime'
change QTime to QElapsedTimer
error 7: no member named 'toAscii' in 'QString'
FILE * fp = fopen(swcfile.toAscii(), "wt");
==>
FILE * fp = fopen(swcfile.toLatin1(), "wt");
error 8: no member named 'getInteger' in 'QInputDialog'
int threshold = QInputDialog::getInteger(parent, QObject::tr("Threshold"),
QObject::tr("Enter threshold:"),
100, 0, 255, 1, &ok);
==>
int threshold = QInputDialog::getInt(parent, QObject::tr("Threshold"),
QObject::tr("Enter threshold:"),
100, 0, 255, 1, &ok);
error 9: 'UnicodeUTF8' is not a member of 'QApplication'
ParaDialog->setWindowTitle(QApplication::translate("ParaDialog", "C.elegans Straighten", 0, QApplication::UnicodeUTF8));
==>
ParaDialog->setWindowTitle(QApplication::translate("ParaDialog", "C.elegans Straighten", 0));
error 10: reference to 'byte' is ambiguous typedef byte cs_byte; ^~~~
C++17 added std::byte and changed the semantics of bytes. In order to avoid pollution of the global namespace. And we need to isolate std::byte from ourselves. Our change is to move its byte into our namespace. Or delete C++17 in the pro file
==>
#define byte win_byte_override
#include <Windows.h>
#include <gdiplus.h>
#undef byte
error 11: no match for 'operator<<' (operand types are 'QTextStream' and '')
Most occurrences of endl
triggered the warning: 'endl' is deprecated: Use Qt::endl
. Some occurrences triggered an error: ‘endl’ was not declared in this scope
. The compiler couldn’t distinguish between std::endl
and Qt::endl
.
myfile<<"# id,type,x,y,z,r,pid"<<endl;
==>
myfile<<"# id,type,x,y,z,r,pid"<<Qt::endl;
error 12: no member named 'insertMulti' in 'QHash<long, long>'
This function is obsolete in Qt6. It is provided to keep old source code working. We strongly advise against using it in new code. Use insert() instead.
*error 13: cannot initialize a parameter of type 'QEnterEvent ' with an lvalue of type 'QEvent'
void MyComboBox::enterEvent(QEvent *e)
{
updateList();
QComboBox::enterEvent(e);
}
==>
void MyComboBox::enterEvent(QEnterEvent *e)
{
updateList();
QComboBox::enterEvent(e);
error 14: 'class QListWidget' has no member named 'isItemSelected'; did you mean 'itemClicked'?
if (list_markers->isItemSelected(list_markers->currentItem()))
==>
if (list_markers->currentItem()->isSelected())
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns true
if item is selected; otherwise returns false
.
This function is deprecated. Use QListWidgetItem::isSelected instead.
error 15: macro "min" passed 3 arguments, but takes just 2 error: expected ‘)’ before ‘const
#undef max
#undef min
error 16: expected type-specifier before 'QWindowsStyle' QGroupBox_channel_main->setStyle(new QWindowsStyle()); ^~~~~~~~~~~~~
QGroupBox_channel_main->setStyle(new QWindowsStyle());
==>
QGroupBox_channel_main->setStyle(new QCommonStyle());
error 17: no member named 'setBackgroundColor' in 'QListWidgetItem'
QListWidgetItem * newItem = new QListWidgetItem;
newItem->setText("marker "+ QString::number(i+1)+" on spine. Rejected");
newItem->setBackgroundColor(red);
==>
QListWidgetItem * newItem = new QListWidgetItem;
newItem->setText("marker "+ QString::number(i+1)+" on spine. Rejected");
newItem->setBackground(red); ^
error 18: QString::SplitBehavior’ has not been declared
auto nameParts = customer->name()
.split(' ', QString::SkipEmptyParts);
Like many other enum constants, QString::SkipEmptyParts
was moved into the namespace Qt
. The problem often occurs as a warning:
‘... QString::split ...’ is deprecated: Use Qt::SplitBehavior variant instead [-Wdeprecated-declarations]
Fix:
auto nameParts = customer->name()
.split(' ', Qt::SkipEmptyParts);
error 19: ISO C++17 does not allow dynamic exception specifications
void *fhandle = 0, int n_pages = -1, bool do_open = true ) throw (iim::IOException); ^~~~~
==>
void *fhandle = 0, int n_pages = -1, bool do_open = true ) noexcept(false);
error 20: QPrintDialog: No such file or directory
#include ^~~~~~~~~~~~~~
QT += printsupport
error 21: no member named 'Delta' in QWheelEvent
QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event);
if(wheelEvent->delta() > 0) {
this->spin->setValue(this->spin->value() + 1);
==>
QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event);
if(wheelEvent->angleDelta().y() > 0) {
this->spin->setValue(this->spin->value() + 1);
error 22: cannot find -lv3dtiff ,error: ld returned 1 exit status
You can follow the instruction to build tiff library and then link libtiff.a or libtiff.so in your pro file.