Solved Searching Button Text
-
So frustrating.... every where on google I've searched, that line is correctly written... but it throws that error.... grrrr
QList<QPushButton *> buttons = findChildren<QPushButton *>();
The Syntax Error: '>'
What a mess lol....
-
HAHA, I'm always messing with stuff. I've been removing and editing now for like an hour or more. I have it working. I removed the void findChildren(); from the header and it worked. lol....
only issue is, it still shows the EMPTY buttons instead of removing them. Yeah, it removes the text and hides it, but in order to get to the exe that it's searching, I must scroll down to get to it.
I'm assuming it's coded to just remove the text...not the buttons?
Anyway.. thank you very much hon, and sorry for being difficult.
-
Sorry, my misinformation. It's removing the buttons, but showing the icons. That is why I"m having to scroll down to get to the program. I'm going to try and write something to remove the icons as well. Wish me luck. If you feel generous, maybe you can help me get that done :)
You are GREAT.. So thank you very much. This is what it looks like when I search for something at the bottom of the window lol...
-
Aha lol... I figured out how to remove the labels as well. I"m a fast learner once I get the code lol...
Now, having the results appear at the top is the last thing. Right now they appear in the middle. It might just be as easy as aligning the scroll area, so I'll mess with it. Thank you again. I'll let you know what I come up with. YAY YOU...thx hon
-
Okay hon... my last reply to you lol. I get excited when things work out and work properly :D
This is what it looks like when I search.
https://gyazo.com/a28eacded4f5faa1861062dde5fc6c20
Now I have aligned the actual scroll area to be aligned to the top and the left, but that didn't work. Just need to figure out how to put the searched items at the top and not separated. Any ideas? If u're tired of me, no worries, I"ll figure it out, or make it work as is. You've been extremely wonderful. Thank you and the other guy...
---------{@ X Eternity
-
@Epiales666 Hmm, did you try
setAlignment(Qt::AlignHCenter | Qt::AlignTop);
?I don't work with scroll areas much but that alignment should do it. It could be from hiding and showing those labels and buttons that is causing it to act weird. Not necessarily the best solution but it should work. :)
Also if you make a custom class for your buttons that can handle the picture and the button then you wouldn't need to hide/show them separately since it would just be one object. Something for a later time once you learn a bit more. :)
-
@ambershark said in Searching Button Text:
setAlignment(Qt::AlignHCenter | Qt::AlignTop);
yeah, I've been working on it since I talked to you last. Haven't taken a break, and havn't figured anything out lmao...
When I put the above in the cpp, I get this:
C:\Users\dclar.DESKTOP-JTNNAGR\Desktop\test\ApplicationPicker\mainwindow.cpp:200: error: C3861: 'setAlignment': identifier not found
-
@Epiales666 Well you need your scroll area object... I don't know what it's called but I'll assume it's in your ui variable... let's just say
ui->myScrollArea->setAlignment(...)
that should help you. Of course replace it with the actual variable. :)You could probably set that in designer too somewhere. I'm not sure though I don't really use the designer. I tend to just write the code by hand.
-
Makes sense... it's just scrollArea.. and I added but it doesn't actually do anything. There are no errors, but it doesn't work ... Story of my life LOL... Thanks Hon... I'm still a chuggin along working on it. :)
-
I have tried this:
ui->scrollArea->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
Maybe it's a scroll area thing. I have no idea why it won't work.
-
Okay... I had the stuff snapped to the mainwindows grid, so that's why I couldn't align it properly. I rewrote the entire thing and it works now. At least mostly. Some items will show in the middle, while most of them show at the top. Not sure why it does that, but it's workable.
And about the labels? When I do a search/filter on the labels, along with the buttons, they show up just fine without any issues. But once I put a picture in the label, they don't show anymore. Not sure why that would have anything to do with it, since it's still considered a QLabel...
Anyway, it works as good as I can get it I think. Thank you so very much for your help.