slot

Associate signal and slot to a qcheckbox create dynamically

元气小坏坏 提交于 2020-01-03 03:39:04
问题 I've got a very specific problem so I'm going to try to be as clear as possible. I've got a QTabWidget which contains QTableWidget , every line of my QTableWidget is create dynamically by reading a file. As you may see, when I create a line, I add a qCheckBox at the end. My goal now, is to send this line to the QTableWidget in the last tab of my QtableTab when I click on the qCheckBox ( and to delete this line when I uncheck the qCheckBox ). So every time I create a line dynamically, I try to

Qt5 new signal to lambda connections memory leak

人盡茶涼 提交于 2019-12-30 05:35:07
问题 The new Qt5 signals and slots syntax allows us to connect signals not only to slots, but also to plain old functions and functors/lambdas. Now the problem is, that lambdas are essentialy objects with () operator, and when you connect signals to them, they get copied somewhere in qt internal classes. And, when you disconnect the signal from that functor, it stays in qt internals. I fail to understand, is that a normal behaviour? Or maybe there is a way to destroy those functional objects after

How to add a list of QActions to a QMenu and handle them with a single slot?

左心房为你撑大大i 提交于 2019-12-29 06:47:10
问题 First, I have a list of QWidget s that I won't know the length of until runtime. I then create a QListWidget where I show them and when someone clicks them I use the signal currentItemChanged(QListWidgetItem*, QListWidgetItem*) to catch it and get the clicked item's index. Now I want to do a similar thing in the QMenu . I will know the list when the QMenu and its actions get built, but I won't be able to hard code this. How can I create actions, catch their signals and connect them to the

Qwt for Qt: How to connect to signal with new signal/slot flavour?

爷,独闯天下 提交于 2019-12-25 16:55:55
问题 I want to to connect to legend-label SIGNAL checked. With Qts old Signal/Slot-Syntax all is perfect, but i want to use the new connection to enable compile-time check? Any idea on how to connect it via new Signal/Slot-Syntax? This is my code: connect( m_plotLegend, SIGNAL( checked( const QVariant &, bool, int ) ), SLOT(legendChecked( const QVariant &, bool ) ) ); //connect(m_plotLegend, &QwtLegend::checked, this, &MeasurePlot::legendChecked); With oldy syntax all is fine, with the new syntax

Refresh QML Listview from Slot

a 夏天 提交于 2019-12-25 04:27:32
问题 I have problem with the refreshing Listview in QML I looked through many solutions but there is nothing concrete i want from event "onClicked" refresh all listview but how to do this? sourcecode: http://s000.tinyupload.com/?file_id=86538244635919176055 main.cpp #include <QApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include <QDebug> #include "message.h" #include "dataobject.h" int main(int argc, char *argv[]) { QList<QObject*> dataList; dataList.append(new DataObject(

Qt Mainwindow menu signals

孤街浪徒 提交于 2019-12-24 11:05:26
问题 I've "Core" object that handles QMainWindow. Core.h code class Core : public QObject { Q_OBJECT public: explicit Core(QObject *parent = 0); ~Core(); void appInit(); int getAuth(); public slots: void appExit(); private slots: void appMenuTriggered(QAction *action); private: void preInit(); MainWindow *mwnd; }; Core.cpp code Core::Core(QObject *parent) : QObject(parent) { qDebug() << "Core::Constructor called"; preInit(); } Core::~Core() { delete mwnd; qDebug() << "Core::Destructor called"; }

How to pass a value with a clicked signal from a Qt PushButton? [duplicate]

我的梦境 提交于 2019-12-23 12:35:06
问题 This question already has answers here : Passing an argument to a slot (5 answers) Closed 4 years ago . I have n buttons initially all labeled '0'. These labels, or values, will change to different integers when the program runs, for example at some point I may have: '7', '0', '2', ... I have a function (or slot) that takes an int as argument: void do_stuff(int i); I want to call do_stuff(x) when 'x' is pressed. That is: when whatever button is pressed, call do_stuff with that button's value.

R_Extracting coordinates from SpatialPolygonsDataFrame

烈酒焚心 提交于 2019-12-21 01:29:12
问题 Is it only me who have the problem with extracting coordinates of a polygon from SpatialPolygonsDataFrame object? I am able to extract other slots of the object ( ID , plotOrder ) but not coordinates ( coords ). I don't know what I am doing wrong. Please find below my R session where bdryData being the SpatialPolygonsDataFrame object with two polygons. > bdryData An object of class "SpatialPolygonsDataFrame" Slot "data": ID GRIDCODE 0 1 0 1 2 0 Slot "polygons": [[1]] An object of class

How to render a list of static content with Vue named slot?

你离开我真会死。 提交于 2019-12-20 09:55:41
问题 I have trouble figuring out how to get the following to work: My parent template <comp> <a href="#" slot="links>link 1</a> <a href="#" slot="links>link 2</a> </comp> and my component comp template looks like the following: <ul class="comp"> <li class="comp-item"><slot name="links"></slot></li> </ul> currently all my anchors goes to that single li tag (which is expected) but I would like to be able to produce multiple li for every named slot I inserted like the following: <ul class="comp"> <li

Member function as a Qt Slot

为君一笑 提交于 2019-12-14 02:35:12
问题 I need to connect a button to a member function from another class. Here the class' code : int g_switch_value = 0; int filterInt = 0; int lastfilterInt = -1; void MoyenEtMedian::switch_callback(int position, void* object) { MoyenEtMedian* moyetmed = (MoyenEtMedian*) object; filterInt = position; } void MoyenEtMedian::exec(void) { const char* name = "Filtres"; IplImage* img = cvLoadImage( "image.png" ); IplImage* out = cvCreateImage( cvGetSize(img), IPL_DEPTH_8U, 3 ); cvNamedWindow( name, 1 );