Questions tagged [slots]

`__slots__` is a python language feature to reduce size of object instances by dropping the builtin dictionary every python instance normally features in order to support dynamic assignment of attributes and replacing it with a fixed set of attributes (the 'slots').

__slots__ is a python language feature to reduce size of object instances by dropping the builtin dictionary every python instance normally features in order to support dynamic assignment of attributes and replacing it with a fixed set of attributes (the 'slots'). See: https://docs.python.org/2/reference/datamodel.html#slots

306 questions
1
vote
1 answer

PyQt5 Define the slot in a separate module for QShortcut

Main interacts with a GUI defined by a separate module. Two alternative approaches are used in Main to define the slot for a QShortcut. The lambda method works (but seems cumbersome). The direct method works, only if the lambda method is executed…
1
vote
0 answers

QEventloop canot be used without QApplication

I'm currently developing a Console Unit Test Client with Google Test. The Tests involves a step where a binary file is downloaded from a server. To download this file I thought about using Qt. Now I took the example code…
JHeni
  • 455
  • 3
  • 12
1
vote
1 answer

Python automatically slotted dict

I wonder if there exist some mechanism, to somehow freeze an dict and make it automatically some kind of class with slots. I need to store some json files and want to quickly gain the advantages of space-saving slots, but dont want to create all the…
RichieK
  • 474
  • 6
  • 15
1
vote
1 answer

Qt Signal/Slot Issue

I can't figure out what's going wrong here. I want to pass a value from a class to another. Here's the code: mainwindow.h public slots: void printNumbers(int); mainwindow.cpp void MainWindow::printNumbers(int a) { qDebug() <<…
Giuseppe VERGARI
  • 39
  • 1
  • 1
  • 4
1
vote
1 answer

Qt - Right Way to Implement Custom Signals and Slots

I have one MainWindow and one Class; I want to send data between them using custom signal and slot. I can't seem to figure it out, I need help. Here is my code: MainWindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include…
delivite
  • 23
  • 2
  • 7
1
vote
1 answer

Slot Options in Common Lisp structure without specifying any slot value

Is there any way to specify a slot-option for a struct slot without having to give it a default value? This can be of benefit e.g. when defining a base structure from which other structures would inherit, specifying the :types or :read-only without…
Student
  • 708
  • 4
  • 11
1
vote
0 answers

emitting a signal is taking too long

In my application I have the need to use 4 threads. There is the GUI thread (which only handles GUI related stuff), the second thread (Sensor Thread) is responsible for receiving and filtering some sensor data from a network socket, the third…
1
vote
2 answers

Why the introduction of __slots__ was made possible with descriptors?

In this blog post from the series "The History of Python", Guido van Rossum states: Another enhancement made possible with descriptors was the introduction of the __slots__ attribute on classes. I understand this sentence as: under the hood…
Min-Soo Pipefeet
  • 2,208
  • 4
  • 12
  • 31
1
vote
2 answers

How do you get cycling emojis in the same Embed in a Discord bot?

I'm trying to replicate some games from a few discord bots on my server, one of these is slots. Using node.js for reference. I've created a clone of it however am missing one element -> Emoji cycling. Basically in the same Embed message the bot gets…
Oldog
  • 11
  • 2
1
vote
1 answer

QT, C++: How do Signal and Slots works with listWidgetItems?

I have a WidgetList with checkboxes and I want to use these as a signal to call the slotTest function. Unfortunately, the code does not work and I can not find a solution: connect(ui->listWidget, SIGNAL(item->checkState()), this, SLOT(slotTest()),…
MB1995
  • 29
  • 3
1
vote
1 answer

Passing classes in with Slots to vue components

I have a vue component I want to change the style based on if they are an undergrad or postgrad. I know I can pass in a prop and use this value to assign a dynamic class or use it in a computed prop.
TommyD
  • 913
  • 3
  • 17
  • 32
1
vote
1 answer

Why does Qt default signals to be public?

I've realized today that if you have 3 classes like so: class 1 has a signal class 2 has a signal that connects to class 3's private slot class 3 has a private slot and class 2 is a friend of class 3 If I connect class 1's signal to class 2's…
1
vote
0 answers

Parent component slots inside children component vue 2.x

I have a modal that have 2 slots, default slot and buttons slot, in the default slot i will set the content of the modal (in this case i will use an alert) and in buttons slot i will add some buttons (in this case a delete button). Now i want to…
Carlos Salazar
  • 1,818
  • 5
  • 25
  • 48
1
vote
1 answer

How to get the value to enter a gtk.entry field and use it outside the button signal

I use Python3.6 with gi.repository. Indeed I have created a Gtk.Entry that the user must fill in. This field is followed by a button. I would like to recover the value of the Gtk.Entry when the user clicks on the button. For my part I have created a…
Lone.S
  • 11
  • 2
1
vote
1 answer

Is it possible to create a python object which does not have either a __slots__ nor a __dict__?

Is it possible to create a python object which does not have either a __slots__ a __dict__?
Toothpick Anemone
  • 4,290
  • 2
  • 20
  • 42