free blog   apache   shopping directory   php powered
jpnurmipick the best idea ;)
ukkopekkaAgain this same question: How can I print char in HEX?
arkaschaCan someone give me a hint, I read about half of the internet, without success...
arkaschaI want to sublass QSlider, adding a legend and some additional functions
thiago_homeukkopekka: write your own code
arkaschaInsider the constructor I create a layout and add all the widgets I require
thiago_homeukkopekka: it's two lines
arkaschaBut how can I add the layout of the widget I subclassed from, the QSlider ?!?
chakiearkascha: sounds like your widget should not subclass QSlider, but use it in a compositional manner
thiago_homeakennedy: you should have subclassed QWidget
arkaschanot sure, considered this, but decided against.
ukkopekkathiago_home: I just don't get it right
arkaschathat would mean I have to reimplement all routines
arkaschawhat for ??
thiago_homeukkopekka: it's not very hard
thiago_homeukkopekka: but if you want a cannon to kill a fly, use QByteArray::toHex
arkaschaI dont want a private member of type QSlider, but I want to subclass it.
ukkopekkathiago_home: seems to be for me :/
chakiearkascha: why must you subclass it?
ukkopekkathiago_home: ok now I got it with that toHex
chakiearkascha: you can expose the internal QSlider* if needed
arkaschachakie: to be able to use signals and slots just like in the original QSlider
arkaschachakie: how do I "expose" it ?
chakie[14:48] <chakie> arkascha: you can expose the internal QSlider* if needed
chakieadd an accessor method
chakieQSlider * MyWidget::getSlider() { return m_slider; }
arkaschachakie: I will have a look at that, but still I dont see why I must have an internal QSlider object.
chakie[14:47] <chakie> arkascha: why must you subclass it?
chakiewhy not base in on QWidget and compose other widgets as needed?
arkaschachakie: if I dont I have to define a private QSlider object. AND I have to connect all signals and slots AND i have to reimplement all methods. What for ?
arkaschachakie: if I subclass it I can simply USE the signals, slots and methods, I'd guess.
chakieadd an accessor method
chakiebut you're stuck in your way of thinking, i won't waste my time here
arkaschachakie: sure, sorry for wasting your time :-) I will take a look into your suggestion.
chakiedon't ask for help if only your current solution is acceptable
chakiewhich is a bad solution in this case
arkaschachakie: I did not do that, sorry. I asked for help ina detail where I am stuck. I never declared that other solutions dont work. Just looking for an elegant solution.
chakiearkascha: ok, so you want to add extra widgets to your QSlider?
chakiei assume a legend is soemthing that explains something?
arkaschachakie: that was my idea, indeed.
chakiecan't it be a separate widget that's just used near a normal QSlider?
chakiebut if they must be together, i'd use composition
arkaschachakie: that would mean to push the controls into the embracing routines, e.g. main.cpp. Not really elegant.
arkaschachakie: composition surely is the typical solution, tried that.
chakiehm, no
chakieyou can still subclass
chakieclass LegendarySlider : public QWidget { QSlider * slider; Legend * legend; }
chakieand some layout in there too
chakiepossibly expose the "slider" or relay the signals
arkaschachakie: true, works, straight forward. I can subclass, but as mentioned I'd have to double all methods, signals and slots. BUT;:
arkaschachakie: I will first have to take a look into "exposition".
arkaschachakie: seems I missed something there.
chakiedouble all methods? why? your LegendarySlider would perform all setup
arkaschachakie: so thanks for the hint !
chakienot "exposition", exposing
arkaschachakie: typo
chakieand it's just a word, not a fancy term for something sexy
arkaschachakie: it is NOT sexy ? wont use it then :-))
chakieQSlider * LegendarySlider::getSlider() { return slider; }
chakieif someone needs to do assloads of stuff on the slider
arkaschachakie: ah, ok. So thats all.
chakiebut i doubt you really need to have externals be able to access it
arkaschachakie: but then the outside world has to know about the LegendarySlliders internals.
arkaschachakie: cause I first have to get the slider to for example add ticks.
arkaschachakie: that means I have to KNOW there is a QSlider in there.
chakiethat is taken care of by your class
arkaschachakie: by an additional method, I'd guess ?
chakiein the constructor for instance
chakieyou're thinking way too complex here
arkaschachakie: no, I mean manipulating the LegendarySlider later on, not in the constructor.
chakiewhy does it have to be manipulated?
arkaschachakie: I'd like to be able to manipulate a LegendarySlider exactly the way I can with aQSlider
chakieyou make it an own class so that it can define stuff on its onw
arkaschachakie: but that makes my class unusable for others, doesnt it ?
chakiethen add an accessor method
chakieto me making such a class at all sounds a bit like waste of time
chakiei'd perhaps just make the legend into an own class and use a normal QSlider
arkaschachakie: I'd say it is the only way to program in a style that can be reused later on...
chakiewill it ever be resused? likely not
arkaschachakie: I read something about the "The Multiple Inheritance Approach", but I dont understand that, (sorry)
chakiethat's when you use .ui files
chakie!f component
qtassistantchakie: [using a component]
arkaschachakie: I always assume that my code will be reused.
arkaschachakie: I mean that is the idea of OOP, isnt it ?
chakieso you overdesign the classes?
chakiemake them complex and hard to use
chakieto me a class does one thing and does it well
arkaschachakie: why hard to use ? They can be used exactly like a QSlider, so it is easy to use them.
arkaschachakie: that is the odea behind it.
chakieanyway, i have to run
arkaschachakie: ok, thanks !!
chakiebut don't try to base it on a QSlider subclass
chakietherein lies dragon
Action: arkascha laughs out loud
philthno2Hi, I added an ActionGroup to my toolbar and want to connect this to a QGraphicsScene (to change a state there). Should I make a slot "action_changed(QAction *new_action)" there and if yes, what's the variable in a QAction I should use to identify it? Something like "if action->text == "Foo" then changeStateToFoo()"?
philthno2Or is it better to change the state in the object that knows all the actions, and emit a stateChanged(new state) there?
philthno2(in my case, QMainWindow)
philthno2Ah, I think I should use QAction::setData() to use a QAction in in a switch-construct. Is that right?
halvors1How hide the titlebarwidget in a window?
halvors1in a dockwidget sry*
richmoore3halvors1: probably using Qt::CustomizeWindowHint
richmoore3when you instantiate it pass that as the window flags argument to the constructor
halvors1so it should be?
halvors1i am a noob in qt, can you come with some exemples
richmoore3new QDockWidget("blah", parent, Qt::CustomizeWindowHint)
halvors1so i should not use ui->dockWidget-> or someting?
richmoore3a quick google actually suggests you can do it by calling setTitleWidget(0); actually
halvors1C:/Users/halvors/Documents/My Dropbox/OpenRcon/src/MainWindow.cpp:9: error: 'class QDockWidget' has no member named 'setTitleWidget'
halvors1the titlebar is there, noe too :(
halvors1this doas not work
halvors1so what sould i do then?
thiago_homewhy doesn't it work?
richmoorethiago_home: i have an implementation of CN/hostname validation now that works and passes a decent set of tests
richmoorethiago_home: am i right in assuming this is too late for 4.7?
halvors1the tittle bar is ther eindted of noting
__robcould someone point me in the right direction, I wanted some text that is a child of a frame to be paintable outside of the bounds of the parent frame
__robinstead of getting clipped
specialwhere 'frame' means a widget?
__roba QFrame widget
specialyou should probably rethink what you're doing
specialthere is Qt::WA_PaintUnclipped, but it has caveats
__robwell no, I want to add a label
__robto the frame
__robbut then I want the frame to treated as it aslways is
__robso I dont want to add a margin
__robjust so my text gets painted
__robI would rather the text gets painted outside of its bounds and worry about padding the widget in a layout or something
specialare you aware that QLabel inherits QFrame?
__robIt doesn't
__robI dont think
specialit does
__robohh, ok
__robeither way, I have a child label Widget, added inside the constuctor of a QFrame widget
__robI am only subclassing the QFrame widget to make my own QLabeledFrame widget
__robin which all it does is create a child QLabel, set the background to draw opaque, use a QFontMetrics to get the size of the QLabel, then draw it in the right place..
__robwhich works, but the top of the text gets clipped
ApetriniI thought for a while but I can't understand how can I know about "mouseReleaseEvent" if the mousePressEvent was make inside the widget but the release outside. Any ideas ?
richmooreApetrini: there is an implicit grab so you get the event  as normal iirc
halvorsHow hide the tittlebar in a dockWidget?
Apetrinirichmoore: mmm, maybe I did some mess with the events, I will take a look, thanks
peppehalvors: setTitleBarWidget(0) ? titleBarWidget()->hide()?
richmoorehalvors:  read this
halvorsno it doesn't work :(
halvorssome other way?
aepchicken blood
halvorsno ideas
ApetriniI just realize that mouseReleaseEvent is never called after mouseMoveEvent. is this the right behaviour ?
aepApetrini: if you didnt release it, yes
richmooreApetrini: check you've got the signature of your mouseReleaseEvent handler right
Apetriniaep: lol. I obviously released it.
aepon the widget you are expecting the event?
Apetriniaep, richmoore : if I just click, both mousePressEvent and mouseReleaseEvent is called
richmooreApetrini: and did you call the base class implementation?
Apetrinibut if I click, hold down the button, move a bit and then release, mouseReleaseEvent is never called
Apetriniaep: on the widget or outside the widget doesn't make any difference
aepshow code
Apetrinirichmoore: base class implementation of what ?
qtassistantaep: [testcase] Having a good testcase is critical for us to be able to help you. Pastebin ( ) a Short, Self Contained, Correct (Compilable), Example. Read if you don't know how.
richmooreApetrini: i'm wondering if you called the base class implementation of the event handlers you've reimplemented
Apetrinirichmoore: I don't
richmoorei don't think that should make a difference, but it might be worth a shot. i've never had any problem similar to the one you're describing
Apetriniaep, richmoore: was the "drag->exec(..)" inside the mouseMoveEvent that blocks .
Apetriniah, now at least I found the problem, aep , richmoore, really thanks.
richmoore3ah good
astruasdhplease, guys... is there audio support in qt framework?
Xenakiossome, but it's somewhat fragmented
Xenakiosdifferent things capable of doing different things
Xenakiossome are easy to use but don't offer any low level control
Xenakiossome stuff not only allows low level stuff but requires you to implement stuff yourself
Xenakioswhat do you want to do?
astruasdha voip application
Xenakiosmy quick guess is that Qt doesn't offer all the necessary components for doing that
Xenakiosfor example you are going to need some audio compression codec system, to get decent sound over the network at a low enough bandwidth
cos^yep, nothing low level enough in qt currently
Xenakioswell, there's audio input and output in Qt Multimedia
Xenakiosbut using that is somewhat involved
astruasdhgot it
Popular searches: Unerwartete Antwort von https   perl couldn   curl-result   qt instance of   SQ004681V03   

Generated by 2.1mg by Jeff Waugh - return