Re: Clear text of LineEdit
Then coverImageLEdit is not pointing to the line edit you think it is. If the pointer was invalid, you would get a crash (almost certainly).
I suggest you look at all references of coverImageLEdit and see if you assign it any different instances.
You can easily check the address of the coverImageLEdit instance made in setupUi, and then check again the address of the lineedit that is being cleared in your function to confirm.
Re: Clear text of LineEdit
so I check the address of the coverImageLEdit in the setupUi and it was able to return an address but when I check the address of the coverImageLEdit inside the checkImageSize() function it doesn't return anything
I used this code
Code:
std::cout << &ui->coverImageLEdit;
Re: Clear text of LineEdit
you dont want the address of the pointer, you want the address of the lineedit, which is just ui->coverImageLEdit (no ampersand).
Re: Clear text of LineEdit
i check the addresses of the two and their not the same in the setupUi the address is 0x86498e0 and in the checkImage() function the address is 0x8c24710. I also checked my ui_mainwindow.h and everything seems to be declared and used properly.
Any comments on how to fix this??
Re: Clear text of LineEdit
Show us the constructor for your class.
Re: Clear text of LineEdit
Here it is
Code:
{
if (MainWindow->objectName().isEmpty())
MainWindow
->setObjectName
(QString::fromUtf8("MainWindow"));
MainWindow->move(500, 250);
action_Help
= new QAction(MainWindow
);
action_Help
->setObjectName
(QString::fromUtf8("action_Help"));
action_About
= new QAction(MainWindow
);
action_About
->setObjectName
(QString::fromUtf8("action_About"));
centralWidget
= new QWidget(MainWindow
);
centralWidget
->setObjectName
(QString::fromUtf8("centralWidget"));
tabWidgetWatermark
= new QTabWidget(centralWidget
);
tabWidgetWatermark
->setObjectName
(QString::fromUtf8("tabWidgetWatermark"));
tabWidgetWatermark
->setGeometry
(QRect(10,
0,
441,
191));
tab
->setObjectName
(QString::fromUtf8("tab"));
hostImageBtn
->setObjectName
(QString::fromUtf8("hostImageBtn"));
hostImageBtn
->setGeometry
(QRect(20,
20,
151,
27));
coverImageBtn
->setObjectName
(QString::fromUtf8("coverImageBtn"));
coverImageBtn
->setGeometry
(QRect(20,
60,
151,
27));
applyWatermarkBtn
->setObjectName
(QString::fromUtf8("applyWatermarkBtn"));
applyWatermarkBtn
->setGeometry
(QRect(200,
100,
151,
27));
hostImageLEdit
->setObjectName
(QString::fromUtf8("hostImageLEdit"));
hostImageLEdit
->setGeometry
(QRect(190,
20,
191,
27));
hostImageLEdit->setReadOnly(TRUE);
coverImageLEdit
->setObjectName
(QString::fromUtf8("coverImageLEdit"));
coverImageLEdit
->setGeometry
(QRect(190,
60,
191,
27));
coverImageLEdit->setReadOnly(TRUE);
tabWidgetWatermark
->addTab
(tab,
QString());
tab_2
->setObjectName
(QString::fromUtf8("tab_2"));
browseExtractBtn
->setObjectName
(QString::fromUtf8("browseExtractBtn"));
browseExtractBtn
->setGeometry
(QRect(20,
20,
151,
27));
extractBtn
->setObjectName
(QString::fromUtf8("extractBtn"));
extractBtn
->setGeometry
(QRect(210,
60,
151,
27));
extractLEdit
->setObjectName
(QString::fromUtf8("extractLEdit"));
extractLEdit
->setGeometry
(QRect(190,
20,
191,
27));
extractLEdit->setReadOnly(TRUE);
tabWidgetWatermark
->addTab
(tab_2,
QString());
MainWindow->setCentralWidget(centralWidget);
menuBar
->setObjectName
(QString::fromUtf8("menuBar"));
menuBar
->setGeometry
(QRect(0,
0,
463,
25));
menu_Help
= new QMenu(menuBar
);
menu_Help
->setObjectName
(QString::fromUtf8("menu_Help"));
MainWindow->setMenuBar(menuBar);
mainToolBar
->setObjectName
(QString::fromUtf8("mainToolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar
->setObjectName
(QString::fromUtf8("statusBar"));
MainWindow->setStatusBar(statusBar);
menuBar->addAction(menu_Help->menuAction());
menu_Help->addSeparator();
menu_Help->addAction(action_Help);
menu_Help->addAction(action_About);
retranslateUi(MainWindow);
tabWidgetWatermark->setCurrentIndex(0);
} // setupUi
Re: Clear text of LineEdit
That's not a constructor.